#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), pref(n)
    for (int i=0; i<n; i++)
    {
        ll b;
        cin>>d[i]>>b;
        prefg[i]=prefg[i-1]*(i>0)+b;
    }
    for (int i=0; i<n; i++)
    {
        pref[i]=pref[i-1]*(i>0)+prefg[i];
    }
    while (q--)
    {
        ll z;
        cin>>z;
        if (lower_bound(pref.begin(), pref.end(), z)!=pref.end()) cout<<lower_bound(pref.begin(), pref.end(), z)-pref.begin()+1<<endl;
        else cout<<-1<<endl;
    }
    return 0;
}