#include <iostream>

using namespace std;

int main()
{
    int n,q;cin>>n>>q;
    int a[n]={},p[n]={},b[q]={},suma[n]={};
    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        a[i]=x;
        p[i]=y;
        for(int j=i;j<n;j++){
            int f;
            f=max((p[i]*(j-i+1)),(a[i]));
            suma[j]+=f;
        }
    }
    for(int i=0;i<q;i++){
        int x;
        cin>>x;
        b[i]=x;
    }
    for(int i=0;i<q;i++){
        if(b[i]>suma[n-1]){
            cout<<-1<<endl;
        }
        else{
            for(int j=0;j<n;j++){
                if(suma[j]>=b[i]){
                    cout<<j+1<<endl;
                    break;
                }
            }
        }
    }

}