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