#include<iostream>
using namespace std;
unsigned long long n, q, d, p, k, brd, brp, sol;
bool b[30000007];
int main(){
    scanf("%lld", &n);
    scanf("%lld", &q);
    for(int i = 1; i <= n; i++){
        scanf("%lld", &d);
        scanf("%lld", &p);
        brd = d;
        brp = p;
        for(int j = brd; brp > 0; j++){
            if(b[j] == 0){
                b[j] = 1;
                brp--;
            }
        }
    }
    for(int i = 1; i <= q; i++){
        scanf("%lld", &k);
        sol = 0;
        for(int j = 1; j <= k; j++){
            sol += b[j];
        }
        printf("%lld", sol);
        printf("\n");
    }
    return 0;
}