#include <bits/stdc++.h>
#define pb push_back
#define int long long

using namespace std;

vector<pair<int , int>>v1;
int n;

map <int , int> mapa;

bool moguce(int & mid , int & p){
    if (mapa[mid] != 0){
        return mapa[mid] >= p;
    }

    int res = 0;
    for (int i = 0; i<mid && i<v1.size()-1; i++){
        res += max(v1[i].first , v1[i].second*mid);
    }
    mapa[mid] = res;
    return res >= p;
}

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int q , x , y;
    bool x0 = true , y0 = true;
    cin>>n>>q;
    vector<int>yy(n , 0);
    vector<int>xx(n , 0);
        cin>>x>>y;
        if (x != 0){
            x0 = false;
        }
        if (y != 0){
            y0 = false;
        }
        xx[0] = x;
        yy[0] = y;
        int ypr = y;

        v1.pb(make_pair(x , y));

    for (int i = 1; i<n; i++){
        cin>>x>>y;
        if (x != 0){
            x0 = false;
        }
        if (y != 0){
            y0 = false;
        }
        ypr += y;
        xx[i] = xx[i-1] + x;
        yy[i] = yy[i-1] + ypr;

        v1.pb(make_pair(x , y));
    }



    /*for (int i = 0; i<xx.size(); i++){
        cout<<xx[i]<<" ";
    }
    cout<<"\n";
    for (int i = 0; i<yy.size(); i++){
        cout<<yy[i]<<" ";
    }
    cout<<"\n";*/




    if (x0){
        for (int i = 0; i<q; i++){
            cin>>x;
            int mid , l = 0 , r = n;
            if (yy[n-1] < x){
                cout<<"-1\n";
            }else{
                while (l<r){
                    mid = (l+r)/2;
                    if (yy[mid] >= x){
                        r = mid;
                    }else {
                        l = mid+1;
                    }
                }
                cout<<r+1<<"\n";
            }
        }
        return 0;
    }

    if (y0){
        for (int i = 0; i<q; i++){
            cin>>x;
            int mid , l = 0 , r = n;
            if (xx[n-1] < x){
                cout<<"-1\n";
            }else{
                while (l<r){
                    mid = (l+r)/2;
                    if (xx[mid] >= x){
                        r = mid;
                    }else {
                        l = mid+1;
                    }
                }
                cout<<r+1<<"\n";
            }
        }
        return 0;
    }





    for (int i = 0; i<q; i++){
        cin>>x;
        int mid , l = 1 , r = n+1;
        if (!moguce(n , x)){
            cout<<"-1\n";
        }else{
            while (l<r){
                mid = (l+r)/2;
                if (moguce(mid , x)){
                    r = mid;
                }else {
                    l = mid+1;
                }
            }
            cout<<r<<"\n";
        }

    }
    return 0;
}