#include <iostream>
#include <algorithm>

int main() {
    long long n, q, k, br=0, d[300000], p[300000], pom[300000];
    scanf("%lld %lld", &n, &q);
    pom[0]=0;
    for (int i=0; i<n; i++) {
        scanf("%lld %lld", &d[i], &p[i]);
        if (i>0) {
            pom[i]=pom[i-1]+std::min(p[i-1], d[i]-d[i-1]);
            p[i]+=std::max(0LL, p[i-1]-(d[i]-d[i-1]));
        }
    }
    for (int i=0; i<q; i++) {
        scanf("%lld", &k);
        br=std::upper_bound(d, d+n, k)-d-1;
        if (br<0) printf("0\n");
        else printf("%lld\n", pom[br]+std::min(k-d[br]+1, p[br]));
    }
    return 0;
}