#include <stdio.h>

#define MAX_DANI 100000

int main() {
    int N, Q;
    scanf("%d %d", &N, &Q); 

    
    long long dan[MAX_DANI + 1] = {0};

    
    for (int i = 0; i < N; i++) {
        int di, pi;
        scanf("%d %d", &di, &pi);
        dan[di] += pi; 
    }

    
    long long ukpo[MAX_DANI + 1] = {0};
    long long preostalo = 0;

    
    for (int i = 1; i <= MAX_DANI; i++) {
        preostalo += dan[i]; 
        if (preostalo > 0) {
            ukpo[i] = ukpo[i - 1] + 1; 
            preostalo--; 
        } else {
            ukpo[i] = ukpo[i - 1]; 
        }
    }

    for (int i = 0; i < Q; i++) {
        long long kj;
        scanf("%lld", &kj);

        printf("%lld\n", ukpo[kj]);
    }

    return 0;
}