const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
const input = await readline();
const arr = JSON.parse(input.slice(0, input.lastIndexOf(",")));
const deepCopy = (obj) => {
if (obj == null || typeof obj !== "object") {
return obj;
}
const newObj = Array.isArray(obj) ? [] : {};
for (const key in obj) {
newObj[key] = deepCopy(obj[key]);
}
return newObj;
};
const deepCopyArr = deepCopy(arr).sort((a, b) => a - b);
const k = Number(input[input.length - 1]);
let res = Infinity;
let ans = 0;
const target = deepCopyArr[Math.floor(arr.length / 2)];
for (let i = 0; i + k <= arr.length; i++) {
let sum = arr[i];
for (let j = i + 1; j < i + k; j++) {
sum -= arr[j];
}
if (Math.abs(sum - target) <= res) {
res = Math.abs(sum - target);
ans = i;
}
}
console.log(ans);
})();