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

int main() {
    long long N, Q, n, p, d, suma = 0;
    vector<long long> dan, plazma, pitanje;

    cin >> N >> Q;

    for (long long i = 0; i < N; i++) {
        cin >> n >> p;
        dan.push_back(n);
        plazma.push_back(p);
    }

    for (long long i = 0; i < Q; i++) {
        cin >> n;
        pitanje.push_back(n);
    }

    for (auto v : pitanje) {
        d = dan[0];

        for (long long i = 0; i < N; i++) {
            if ((d + plazma[i] < v)) {
                suma += plazma[i];
                if (d + plazma[i] < dan[i]) {
                    d = dan[i] + plazma[i];
                } else {
                    d += plazma[i] - 1;
                }
            } else {
                if (dan[i] > d) {
                    d = dan[i];
                }

                p = plazma[i];

                while (d <= v && p != 0) {
                    p -= 1;
                    suma += 1;
                    d += 1;
                }

                break;
            }
        }

        cout << suma << endl;
        suma = 0;
    }
}