#include int main() { int i, N, Q, A[101]; scanf("%d %d", &N, &Q); for (i = 1; i <= N; i++) scanf("%d", &(A[i])); int j, k, x, l, r, m; long long sum[1000001]; for (i = 1, k = 1, sum[0] = 0; i <= N; i++) for (j = 1; j <= A[i]; j++, k++) sum[k] = sum[k-1] + j; for (i = 1; i <= Q; i++) { scanf("%d", &x); l = 1; r = k; while (l < r) { m = (l + r) / 2; if (sum[m] >= x) r = m; else l = m + 1; } if (l < k) printf("%d\n", l); else printf("-1\n"); } return 0; }