#include <bits/stdc++.h>
using namespace std;

long long max(long long a, long long b) {
    if(a > b)
        return a;
    return b;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long n, q, k;
    cin >> n >> q;
    long long d[n], p[n], l[n], s[n];
    for(int i = 0; i < n; i++) {
        cin >> d[i] >> p[i];
        if(i == 0) {
            l[0] = p[0]-1;
            s[0] = 1;
        }
        else {
            l[i] = p[i] - 1 + max(l[i - 1] - d[i] + d[i - 1] + 1, 0);
            s[i] = s[i - 1] + min(d[i] - d[i - 1] - 1, l[i - 1]) + 1;
        }
    }
    for(int i = 0; i < q; i++) {
        cin >> k;
        int it = (int)(lower_bound(d, d+n, k) - d);
        long long r = 0;
        if(it == 0) {
            r = 0;
        }
        else if(it >= n) {
            r = s[n - 1] + min(l[n - 1], k - d[n - 1]);
        }
        else if(d[it] == k) {
            r = s[it];
        }
        else {
            r = s[it - 1] + min(l[it - 1], k - d[it - 1]);
        }
        cout << r << endl;
    }
    return 0;
}