#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);
    vector<int> k(n);
    int zbir = 0;
    int zbirp = 0;
    int akumulacija = 0;
    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;
        if(i > 0) k[i] = k[i-1] + p + akumulacija;
        else k[i] = p;
        zbir += d;
        akumulacija+=p;
    }
    if(akumulacija == 0){
        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";
        }
    }
    else{
        while(q--){
            int h; cin >> h;
            if(k[lower_bound(k.begin(), k.end(), h)-k.begin()] >= h){
                    cout << lower_bound(k.begin(), k.end(), h)-k.begin()+1 << "\n";
            }
            else cout << "-1\n";
        }
    }
    return 0;
}