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

// from CF
void print(__int128 x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    if (x > 9) print(x / 10);
    putchar(x % 10 + '0');
}
int N,Q;
long long d[300005];
long long p[300005];
__int128 ps[524300];
__int128 ls[524300];
long long k;

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