#include <iostream>
#define ll long long
using namespace std;
ll sumd[200010];
int main()
{
    ll n, q;
    cin >> n >> q;
    ll d[n+10], p[n+10];
    for (ll i=0; i<n; i++)
    {
        cin >> d[i] >> p[i];
        if (i==0) sumd[i]=d[i];
        else sumd[i]=sumd[i-1]+d[i];
    }
    for (ll i=0; i<q; i++)
    {
        ll h; cin >> h;
        if (sumd[n-1]<h) cout << -1 << endl;
        for (ll i=0; i<n; i++)
        {
            if (sumd[i]>=h) {cout << i+1 << endl; break;}
        }
    }
    return 0;
}