#include<bits\stdc++.h>


using namespace std;


#define ll long long
#define ld long double
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pll pair<long, long>

pair<ll, ll> niz[200005];

ll dp[200005];


ll pref[200005];

int main()
{

    SYNC
    int n, q;
    cin >> n >> q;

    vector<ll>p(n + 1, 0);
    vector<ll> d(n + 1, 0);
    bool pNula = true, dNula = true;


    for(int i = 1; i <= n; i++)
    {
        ll a, b;
        cin >> a >> b;
        niz[i] = {a, b};
        pNula = (a != 0 ? false : pNula);
        dNula = (b != 0 ? false : dNula);
    }

    if(pNula)
    {
        for(int i = 1; i <= n; i ++)
        {
            pref[i] += pref[i - 1] + niz[i].second;
        }
        for(int i = 1; i <= n; i ++)
        {
            p[i] = pref[i - 1] * i + niz[i].second;
            //cout << p[i] << " ";
        }

    }

    if(dNula)
    {
        for(int i = 1; i <= n; i ++)
        {
            d[i] += (d[i - 1] + niz[i].first);
        }
    }


    while(q--)
    {
        ll h;
        cin >> h;
        ll res = n;
        if(pNula)
        {
            res = lower_bound(p.begin(), p.end(), h) - p.begin();
        }
        if(dNula)
        {
            res = lower_bound(d.begin(), d.end(), h) - d.begin();
        }

        if(res == n + 1)
        {
            cout << -1 << '\n';
        }
        else
            cout << res << '\n';




    }





    return 0;
}