#include <iostream>
#include <vector>
#include <climits>
#include <map>

using namespace std;

int main() {
    int n, q;
    long long s, r, razlika, t;
    cin >> n >> q;
    long long k[q], d[n], p[n];
    for(int i = 0; i < n; i++) cin >> d[i] >> p[i];
    for(int i = 0; i < q; i++) cin >> k[i];
    for(int i = 0; i < q; i++) {
        r = 0;
        s = 0;
        for(int j = 0; j < n; j++) {
            if(d[j] > k[i]) break;
            s += p[j];
            if(s > 0 && j != n-1 && d[j+1] <= k[i]) {
                razlika = d[j+1] - d[j];
                if(razlika >= s) {
                    r += s;
                    s = 0;
                }
                else {
                    r += razlika;
                    s -= razlika;
                }
            }
            else if(s > 0 && (j == n-1 || d[j+1] > k[i])) {
                razlika = k[i] - d[j] + 1;
                (razlika >= s) ? r += s : r += razlika;
            }
        }
        cout << r << endl;
    }

    return 0;
}