#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];
    int 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];
    }

    int sigpoj = 0;
    int c = 0;
    long long visak = 0;

    for (int i = 0; i < n; ++i) {
        while (c < q && k[c] < d[i]) {
            cout << sigpoj << endl;
            c++;
        }

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

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

    return 0;
}