#include <bits/stdc++.h>

using namespace std;

unsigned long long p[2000005], d[2000005];

int n, q;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> q;
    for(int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp >> p[i];
        if(i == 0) d[i] = tmp;
        else d[i] = d[i - 1] + tmp;
    }
    while(q--) {
        unsigned long long hp, otrovan = 0, umro = -1;
        cin >> hp;
        long long potez = upper_bound(d, d + n, hp) - d;
        cout << (potez == n ? -1 : potez + 1) << '\n';
    }
}
/*
5 2
10 0
10 0
10 0
10 0
10 0
30 65
*/