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

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

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

    long k[q];
    for (int i = 0; i < q; i++) {
        scanf("%d", &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("%d", arr[k[i]]);
    }
    return 0;
}