#include<bits/stdc++.h>
using namespace std;

int N,Q;
long long d[524300];
int p;
long long ps[300005]; // plazma prefix sum
long long ls[300005]; // last AKA remaining inbetween this day and next
long long k;

int main(){
    scanf("%d%d",&N,&Q);
    for(int i=1;i<=N;++i){
        scanf("%lld%d",&d[i],&p);
        ps[i]=ps[i-1]+min(ls[i-1],d[i]-d[i-1]);
        ls[i]=p+max(0ll,ls[i-1]-d[i]+d[i-1]);
    }
    while(Q--){
        scanf("%lld",&k);
        int i=262144;
        int di=131072;
        while(di!=0){
            if(i>N) i-=di;
            else if(d[i]==k) break;
            else if(d[i]<k) i+=di;
            else i-=di;
            di/=2;
        }
        i=min(i,N);
        printf("%lld\n",ps[i]+max(0ll,min(k-d[i]+1,ls[i])));
    }
    return 0;
}