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

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    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()+1 << "\n";
        }
        else cout << "-1\n";
    }
    return 0;
}