#include <bits/stdc++.h>
#define ubrzaj ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const unsigned long long DMAX=100000002;
 long long x[DMAX];
 long long pref[DMAX];

int main()
{
    ubrzaj
    unsigned long long n,q;
    cin >> n >> q;
    vector<pair<unsigned long long,unsigned long long>> v(n);
    for(unsigned long long i=0; i<n; i++){
        cin >> v[i].first >> v[i].second;
        x[v[i].first]+=v[i].second;
        //pref[v[i].first]+=1;
    }
    for(unsigned long long i=1; i<DMAX; i++){
        if(x[i-1]-1>0)x[i]+=x[i-1]-1;
        if(x[i]>0)pref[i]=pref[i-1]+1;
        else pref[i]=pref[i-1];
    }

    for(unsigned long long j=0; j<q; j++){
        unsigned long long a;
        cin >> a;
        cout << pref[a] << endl;
    }
    return 0;
}