#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<int> d, p, query;

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, q; cin  >> n >> q;
    d = p = vector<int>(n+1, 0);
    query = vector<int>(n, 0);

    for(int i = 1; i <= n; i++){
        cin >> d[i] >> p[i];
    }
    for(int i = 0; i < q; i++) cin >> query[i];
    vector<int> pref(n+1, 0);
    for(int i = 1; i < n; i++){
        pref[i] = pref[i - 1] + min(d[i+1] - d[i], p[i]);

        if(d[i+1] - d[i] < p[i]){
            p[i+1] += p[i] - (d[i+1] - d[i]);
        }
    }
    pref[n] = pref[n - 1] + 1;

    for(int i = 0; i < q; i++){
        auto it = lower_bound(d.begin(), d.end(), query[i]);
        int pos = it - d.begin();
        pos = min(pos, n);
        while(query[i] < d[pos]) pos--;
        int ans = pref[max(0ll, pos-1)];
        ans += min(p[pos], query[i] - d[pos] + 1);
        cout << ans << '\n';
    }
    return 0;
}