#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define FAST ios::sync_with_stdio(false);cout.tie(0);cin.tie(0);

#define ff(i,a,b) for(int (i) = (a);(i)<(b);(i)++)
#define fff(i,a,b) for(int (i) = (a);(i)<=(b);(i)++)
#define bff(i,a,b) for(int (i) = (a);(i)>(b);(i)++)
#define bfff(i,a,b) for(int (i) = (a);(i)>=(b);(i)++)

#define pb push_back
#define F first
#define S second

using namespace std;
using namespace __gnu_pbds;

typedef long long int lli;


int main()
{
    int n,q;
    cin>>n;
    cin>>q;
    int napadi[n+5];
    napadi[0] = 0;
    fff(i,1,n){
        int p,d;
        cin>>d;
        cin>>p;
        napadi[i]=napadi[i-1]+d;
    }
    int pocetak = 0;
    int kraj;
    ff(i,0,q){
        int hp;
        cin>>hp;
        if(hp<=0){
            cout<<0<<endl;
            continue;
        }
        if(hp-napadi[n] >0){
            cout<<-1<<endl;
            continue;
        }
        pocetak=1;
        kraj = n;
        int s = (pocetak+kraj)/2;
        do{
            if(napadi[s]<hp){
                pocetak = s+1;
            }else if(napadi[s] > hp && napadi[s-1]>=hp){
                kraj=s;
            }else{
                break;
            }
            s = (pocetak+kraj)/2;
        }while(true);
        cout<<s<<endl;

    }
    return 0;
}