local mfl = math.floor local function comp(a, b) return a < b end local function upper_bound(ary, x) local num = #ary if num == 0 then return 1 end if comp(x, ary[1]) then return 1 end if not comp(x, ary[num]) then return num + 1 end local min, max = 1, num while 1 < max - min do local mid = mfl((min + max) / 2) if not comp(x, ary[mid]) then min = mid else max = mid end end return max end local n, k = io.read("*n", "*n") local s = 0 local t = {} for i = 1, k do t[i] = io.read("*n") s = s + t[i] end local v = {s} for i = k + 1, n do t[i] = io.read("*n") s = s + t[i] - t[i - k] v[i - k + 1] = s end table.sort(v) local q = io.read("*n") for iq = 1, q do local x = io.read("*n") local ub = upper_bound(v, x) print(ub - 1) end