#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, sum[10001]; for (i = 1, k = 1, sum[0] = 0; i <= N; i++) for (j = 1; j <= i; j++, k++) sum[k] = sum[k-1] + A[j]; for (i = 1; i <= Q; i++) { scanf("%d", &x); for (j = 1; j < k; j++) if (sum[j] >= x) break; if (j < k) printf("%d\n", j); else printf("-1\n"); } return 0; }