#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n, q;
    cin>>n>>q;
    vector <ll> d(n), prefg(n);
    for (int i=0; i<n; i++)
    {
        ll b;
        cin>>d[i]>>b;
        prefg[i]=prefg[i-1]*(i>0)+b;
    }
    while (q--)
    {
        ll z;
        cin>>z;
        if (lower_bound(prefg.begin(), prefg.end(), z)!=prefg.end()) cout<<lower_bound(prefg.begin(), prefg.end(), z)-prefg.begin()+1<<endl;
        else cout<<-1<<endl;
    }
    return 0;
}