#include <iostream>
#include <vector>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, q;
    cin >> n >> q;

    long long d[n];
    long long p[n];
    long long k[q];

    for (int i = 0; i < n; ++i) {
        cin >> d[i] >> p[i];
    }

    for (int i = 0; i < q; ++i) {
        cin >> k[i];
    }
    long long sigpoj = 0;
    long long c = 0;
    long long visak = 0;

    for (int i = 0; i < n; ++i) {
        while (k[c] < d[i]) {
            cout << sigpoj << endl;
            c++;
        }
        visak+=p[i];
        long long kr = d[i] - 1 + visak;
        if (i == n - 1 || d[i + 1] > kr) {
            while (k[c] <= kr) {
                cout << sigpoj + k[c] - d[i] + 1 << endl;
                c++;
            }
            sigpoj += visak;
            visak = 0;
        } else {
            while (k[c] <= d[i + 1]) {
                cout << sigpoj + k[c] - d[i] + 1 << endl;
                c++;
            }
            sigpoj += d[i + 1] - d[i];
            visak += d[i] - d[i + 1];
        }
    }

    while (c < q) {
        cout << sigpoj << endl;
        c++;
    }

    return 0;
}