#include <bits/stdc++.h>
int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  long long a[1000 + 1];
  long long t[1000 + 1 + 1][1000 + 1];
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int j = 0; j <= n; j++) t[n + 1][j] = 0;
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j <= n; j++) {
      t[i][j] =
          std::min(t[i + 1][j] - a[i], (j > 0) ? t[i + 1][j - 1] : 1LL << 60LL);
      t[i][j] = std::max(t[i][j], 0LL);
    }
  }
  std::vector<std::pair<long long, int>> values;
  for (int j = 0; j <= n; j++) {
    if (j == 0 || t[1][j] != t[1][j - 1])
      values.push_back(std::make_pair(t[1][j], j));
  }
  std::sort(values.begin(), values.end());
  for (int i = 0; i < m; i++) {
    long long b;
    scanf("%lld", &b);
    auto it =
        std::lower_bound(values.begin(), values.end(), std::make_pair(b, -1));
    if (it == values.end() || it->first > b) it--;
    printf("%d\n", it->second);
  }
  return 0;
}
