#include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
    long long n, q;
    scanf("%lld %lld", &n, &q);

    long long d[n], p[n];
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &d[i], &p[i]);
    }

    long long k[q];
    for (int i = 0; i < q; i++) {
        scanf("%lld", &k[i]);
    }

    long arr[300001] = {0};

    for (int i = 0; i < n; i++) {
        arr[d[i]] = p[i];
    }
    int z = 0;
    int b = 0;
    for(int i = 1; i<d[-1]+p[-1];i++){
        if(arr[i]>0){
            z = z + arr[i];
        }
        if(z>0){
            b = 1;
        }else{b = 0;}
        
        arr[i] = arr[i-1] + b;
        z = max(z-1, 0);
    }
    

    for (int i = 0; i < q; i++) {
        printf("%lld", arr[k[i]]);
    }
    return 0;
}