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

int main() {
    int n, q;
    cin >> n >> q;
    vector<long long> a(n), x(n), k(q);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> x[i];
    }
    for (int i = 0; i < q; i++) {
        cin >> k[i];
    }
    int l=0;
    while(k[l]<=a[0])
    {
        l++;
        cout<<0<<endl;
    }
    int p = 0, j = 0, suma = 0, pojedeno = 0;
    for (long long i = a[0]; i <= k[q-1]; i++) {
        if (j < a.size() && i == a[j]) {
            suma += x[j];
            j++;
        }
        if (suma > 0) {
            pojedeno++;
            suma--;
        }
        if (i == k[p]) {
            cout << pojedeno << endl;
            p++;
        }
    }
    return 0;
}