#include <iostream>

using namespace std;

int main()
{
    int n,q;
    scanf("%d",&n);
    scanf("%d",&q);
    long long d[n][2],k[q];
    d[3][1] = 0;
    for(int i=0;i<n;i++){
        scanf("%lld",&d[i][0]);
        scanf("%lld",&d[i][1]);
    }
    for(int i=0;i<q;i++){
        scanf("%lld",&k[i]);
    }
    int np=0,qp=0;
    long long loc=0;
    long long zb=0,kp=0;
    while(qp<q && np<n){
        if(k[qp]<d[np][0]){
            zb+=min(k[qp]-loc+1,kp);
            kp-=min(k[qp]-loc+1,kp);
            loc = k[qp];
            qp++;
            printf("%lld \n",zb);
        }
        else{
            zb+=min(d[np][0]-loc+1,kp);
            kp=kp - min(d[np][0]-loc+1,kp) + d[np][1];
            loc = d[np][0];
            np++;
        }
    }
    while(qp<q){
        zb+=min(k[qp]-loc+1,kp);
        kp-=min(k[qp]-loc+1,kp);
        loc = k[qp];
        qp++;
        printf("%lld \n",zb);
    }

    return 0;
}