#include <bits/stdc++.h>

using namespace std;

long long v[300100];
long long dp[300100];
long long dp2[300100];

int main()
{
    int n, q;
    cin >> n >> q;
    long long b = 0;
    memset(v, 0, sizeof(v));
    for(int i = 1; i <= n; i++){
        int x, y;
        cin >> x >> y;
        v[x] = y;
    }
    dp[0] = 0;
    for(int i = 0; i < 300100; i++){
        dp[i] = dp[i-1] + v[i];
    }
    dp2[0] = 0;
    for(int i = 1; i < 300100; i++){
        if(dp[i] - b > 0){
            dp2[i] = dp2[i-1] + 1;
            b++;
        }
        else{
            dp2[i] = dp2[i-1];
        }
    }
    while(q--){
        int x;
        cin >> x;
        cout << dp2[x] << endl;
    }
    return 0;
}