#include <bits/stdc++.h>
#define ll long long
using namespace std;


int main(int argc, char**argv){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n, q; cin >> n >> q;
int d[n+3];
int p[n+3];
int k[q+3];
for ( int i = 0; i < n; i++ ){
    cin >> d[i] >> p[i];
}
int s = d[0] - 1;
for( int i = 1; i < n; i++ ){
    s = max( s + p[i-1], d[i] );
}
s = s+p[n-1];
for( int i = 0; i < q; i++ ){
    cin >> k[i];
}
int zaliha[s+4];

for( int i = 0; i < d[i]; i++ ){
    zaliha[i] = 0;
}

for( int i = 0; i < n; i++ ){
    zaliha[d[i]] = zaliha[d[i]-1] + p[i] - 1;
    for ( int j = d[i] + 1; j < d[i+1]; j++ ){
        if( zaliha[j-1] > 0 ){
            zaliha[j] = zaliha[j-1] - 1;
        }
        else{
            zaliha[j] = 0;
        }
    }
}

int minusi[s];
int v = d[n-1]+1;
while( zaliha[v] > 0 ){
    zaliha[v] = zaliha[v-1]-1;
    v++;
}

minusi[0] = 0;
for ( ll i = 1; i < s + 4; i++){
    if ( zaliha[i] > 0 ){
        minusi[i] = minusi[i-1] + 1;
    }
    else{
        minusi[i] = minusi[i-1];
    }
}

for( int i = 0; i < q; i++ ){
    if (k[i] < s+4){
        cout << minusi[k[i]] << endl;
    }
    else{
        cout << minusi[s+4]<< endl;
    }
}
return 0;
}