#include <iostream>

using namespace std;

long long closestDay = 0;

long long srch(long long days[], long long n, long long x){
    long long l=0, r=n-1, sred, indL;

    if (x > days[n-1]){
        closestDay = days[n-1];
        return n-1;
    }

    while (l<=r){
        sred = (l+r)/2;

        indL = days[sred];

        if (indL<x && sred<n-1 && days[sred+1]>x){
            closestDay = indL;
            return sred;
        }
        else if (indL<x) l=sred+1;
        else if (indL>x && sred>0 && days[sred-1]<x){
            closestDay = days[sred-1];
            return sred-1;
        }
        else if (indL>x) r=sred-1;
        else{
            closestDay = indL;
            return sred;
        }
    }
    return -1;
}

void print(long long lst[], long long n){
    cout << endl;

    for (long long i=0; i<n; i++){
        cout << lst[i] << " ";
    }

    cout << endl;
}

int main(){
    long long n=1, q, d, p, kreal, currentSum = 0, cookiesLeft = 0, cookieSumDelta, day;
    long long k;

    cin >> n >> q;

    long long preSum[n+1], cLft[n+1], dayMap[n], soList[q];

    preSum[0] = 0;
    cLft[0] = 0;

    for (long long i=0; i<n; i++){
        cin >> d >> p;

        dayMap[i] = d;

        (i>0)?cookieSumDelta = min(cookiesLeft, d - dayMap[i-1]): cookieSumDelta = min(cookiesLeft, d);

        currentSum += cookieSumDelta;
        cookiesLeft += p - cookieSumDelta;

        preSum[i+1] = currentSum;
        cLft[i+1] = cookiesLeft;
    }

    //print(cLft, n+1);

    for (long long i=0; i<q; i++){
        cin >> k;

        //(k>1e9)? kreal = 1+1e9: kreal = int(k);

        day = srch(dayMap, n, k) + 1;
        //print(dayMap, n);
        soList[i] = preSum[day] + min(k - closestDay+1, cLft[day]);

        //cout << "sig " << preSum[day] + min(k - closestDay+1, cLft[day]) << endl;
        //cout << soList[i];
        //print(soList, q);
    }

    for (long long i=0; i<q; i++){
        cout << soList[i] << endl;
    }
}