#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

int main() {
    int n, q;
    cin >> n >> q;
    vector<pair<ull, int>> unos1;
    for(int i = 0; i < n; i++){
        int d, p;
        cin >> d >> p;
        unos1.push_back(make_pair(d,p));
    }
    vector<ull> unos2;
    for(int i = 0; i < q; i++){
        ull q1;
        cin >> q1;
        unos2.push_back(q1);
    }

    vector<int> dani(300000);
    dani[0] = 0;

    for (int i = 1; i < unos1[0].first; i++){
        dani.push_back(0);    
    }
    int zalihe = 0;

    int br = 0;
    for (int i = 1; i < n; i++){
        zalihe += unos1[br].second;

        for (int j = unos1[br].first; j < unos1[br+1].first; j++){
            if (zalihe > 0){
                dani[j] = dani[j-1] + 1;
                zalihe--;
            }
            else{
                dani[j] = dani[j-1];
            }
        }
        br++;
    }

    zalihe += unos1[n-1].second;
    for (int i = unos1[n-1].first; i <= 300000; i++){
        if (zalihe > 0){
            dani[i] = dani[i-1] + 1;
            zalihe--;
        }
        else{
            dani[i] = dani[i-1];
        }
    }

    for (int i = 0; i < q; i++){
        cout << dani[unos2[i]] << ' ';
    }

    return 0; 
}