func main() var n: int :: cui@inputInt() var k: int :: cui@inputInt() var a: []int :: #[n]int for i(0, n - 1) do a[i] :: cui@inputInt() end for var sum: int :: 0 for i(0, k - 1) do sum :+ a[i] end for var s: []int :: #[n - k + 1]int for i(0, n - k) do s[i] :: sum if(i = n - k) break i end if do sum :- a[i] do sum :+ a[i + k] end for do s.sort() var q: int :: cui@inputInt() for(1, q) var x: int :: cui@inputInt() var ok: int :: -1 var ng: int :: n - k + 1 while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 if(s[mid] <= x) do ok :: mid else do ng :: mid end if end while var ans: int :: ok + 1 do cui@print("\{ans}\n") end for end func