#include <bits/stdc++.h>

#define ll long long

using namespace std;

ll d[300001];
ll p[300001];
ll pref[300001];

void solve(int n) {
    ll k; cin >> k;
    ll res = upper_bound(d, d+n, k) - d;
    if(res == 0) {
        cout << res << '\n';
        return;
    }
    res--;
    ll tmp = pref[res];
    tmp += min(p[res], k - d[res] + 1);
    cout << tmp << '\n';
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, q;
    cin >> n >> q;
    ll k;
    for(int i=0;i<n;i++) {
        cin >> d[i] >> p[i];
        if(i > 0) {
            k = p[i-1];
            if(p[i-1] > d[i] - d[i-1]) {
                k = d[i] - d[i-1];
                p[i] += p[i-1] - (d[i] - d[i-1]);
            }
            pref[i] = pref[i-1] + k;
        }
        else
            pref[i] = 0;
    }
    for(int i=0;i<q;i++) solve(n);
}