fn main() { let mut nk = String::new(); std::io::stdin().read_line(&mut nk).ok(); let nk: Vec = nk.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nk[0]; let k = nk[1]; let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let a: Vec = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut q = String::new(); std::io::stdin().read_line(&mut q).ok(); let q: usize = q.trim().parse().unwrap(); let mut s: Vec = vec![]; let first: isize = a.iter().take(k).sum(); s.push(first); for i in 0..n-k { let prev = s[i]; s.push(prev + a[k+i] - a[i]); } s.sort(); for _ in 0..q { let mut x = String::new(); std::io::stdin().read_line(&mut x).ok(); let x: isize = x.trim().parse().unwrap(); let mut lower: usize = 0; let mut upper: usize = s.len(); while upper > lower { let middle = (upper + lower) / 2; if s[middle] > x { upper = middle; } else { lower = middle + 1; } } println!("{}", upper); } }