#include<bits/stdc++.h>

using namespace std;

int main() {

    int n, q;

    cin >> n >> q;

    unsigned long long dani[n];
    long long plazma[n];

    for (int i = 0; i < n; i++) 
        cin >> dani[i] >> plazma[i];

    unsigned long long upitnik;
    unsigned long long brojac = 0;
    int p = 0; unsigned long long pomoc = 0;
    unsigned long long q0 = 0;

    for(int i = 0; i < q; i++) {
        cin >> upitnik;
        
        if(upitnik < dani[p]) {
            if(pomoc > upitnik - q0) {
                brojac += upitnik - q0;
                pomoc -= upitnik - q0;
            }
            else {
                brojac += pomoc;
                pomoc = 0;
            }
        }

        while(dani[p] < upitnik and p < n) { // upitnik < pomoc?
            pomoc += plazma[p];
            if(dani[p+1] < upitnik and p < n-1) {
            	if(pomoc < dani[p+1] - dani[p]) {
            		brojac += pomoc;
            		pomoc = 0;
            	}
            	else{
                brojac += dani[p+1] - dani[p];
                pomoc -= dani[p+1] - dani[p];
            	}
            }
            else{
                if(pomoc > upitnik - dani[p]) {
                    brojac += upitnik - dani[p];
                    pomoc -= upitnik - dani[p];
                }
                else{
                    brojac += pomoc;
                    pomoc = 0;
                }
            }
            p++;
        }
			

        q0 = upitnik;

        if (brojac == 0)
            cout << 0 << '\n';
        else if(dani[n-1] + brojac < upitnik)
        	cout << brojac << '\n';
        else
            cout << brojac + 1 << '\n';
    }
}