#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
    int n, q; cin >> n >> q;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        int d,p; cin >> d >> p;
        if(i > 0) v[i] = v[i-1]+d;
        else v[i] = d;
    }
    while(q--){
        int h; cin >> h;
        if(v[lower_bound(v.begin(), v.end(), h)-v.begin()] >= h){
                //cout << v[lower_bound(v.begin(), v.end(), h)-v.begin()] << "\n";
                cout << lower_bound(v.begin(), v.end(), h)-v.begin() << "\n";
        }
        else cout << "-1\n";
    }
    return 0;
}