#include<bits/stdc++.h>
using namespace std;
int n,q, res;
long long h[200050];
long long d[200050], p[200050];
bool pr;
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> q;
    for(int i=1; i<=n; i++)
        cin >> d[i] >> p[i];
    for(int i=1; i<=q; i++)
    {
        cin >> h[i];
        pr = 0;
        res = 0;
        for(int j=1; j<=n; j++)
        {
            //cout << h[i] << " " << d[j] << " ";
            h[i] = h[i] - d[j];
            res++;
            //cout << h[i] << " " << res << ", ";
            if(0 >= h[i])
            {
                //cout << endl;
                goto ovde;
            }
        }
        //cout << endl;
        if(pr == 0)
        {
            cout << "-1 \n";
            pr = 1;
        }
        ovde:
        if(pr == 0)
            cout << res << " \n";
        //cout << endl;
    }
    return 0;
}
/*
3 5
3 0
4
0
5 0
3
4
5
13
2

*/