//kad se nasip odlomi+
#include <bits/stdc++.h>

using namespace std;

typedef long long ull;

int main() {
    int n, q; cin >> n >> q;
    vector<ull> d(n),p(n);
    for(int i=0; i<n; i++)cin >> d[i] >> p[i];
    vector<ull> pojela(n,0),zaliha(n,0);
    pojela[0] = 0;
    zaliha[0] = p[0];
    for(int i=1; i<n; i++){
        ull poj = min(d[i]-d[i-1],zaliha[i-1]);
        pojela[i] = pojela[i-1] + poj;
        zaliha[i] = zaliha[i-1] +  p[i] - poj;
    }

    while(q--){
        ull k; cin >> k;
        if(k > d[n-1]){
            ull res = pojela[n-1] + min(k-d[n-1]+1,zaliha[n-1]);
            cout << res << '\n';
            continue;
        }
        if(k <= d[0]){cout << 0 << '\n'; continue;}
        ull pos =upper_bound(d.begin(),d.end(),k) - d.begin() - 1;
        ull res = pojela[pos] + min(k-d[pos]+1,zaliha[pos]);
        cout << res << '\n';
    }
    return 0;
}