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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    long N, Q;
    cin >> N >> Q;
    
    vector<long> d(N), p(N);
    for (long i = 0; i < N; i++) {
        cin >> d[i] >> p[i];
    }
    
    vector<long long> k(Q);
    for (long long j = 0; j < Q; j++) {
        cin >> k[j];
    }
    
    long brojPlazme = 0;
    long pojedenaPlazma = 0;
    vector<long> rez(Q);
    
    long dan = 0;
    long index = 0;
    
    for (long long i = 0; i <= k[Q - 1]; i++) {
        if (dan < N && i == d[dan]) {
            brojPlazme += p[dan];
            dan++;
        }

        if (brojPlazme > 0) {
            pojedenaPlazma++;
            brojPlazme--;
        }

        if (index < Q && i == k[index]) {
            rez[index] = pojedenaPlazma;
            cout << rez[index] << endl;
            index++;
        }
    }

    return 0;
}