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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n,q;
    cin >> n >> q;
    vector<long long> dan(n);
    vector<long long> kol(n);
    vector<long long> S(n);
    for(int i = 0;i < n;i++)
        cin >> dan[i] >> kol[i];

    long long p = 0;
    for(int i = 0;i < n - 1;i++){
        p += kol[i];
        S[i] = min(p,dan[i+1]-dan[i]);
        p -= S[i];
    }
    S[n-1] = p + kol[n-1];

    for(int i = 1;i < n;i++)
        S[i] += S[i-1];

    while(q--){
        long long k;
        cin >> k;
        long long fnd = lower_bound(begin(dan),end(dan),k) - begin(dan);

        if(fnd == 0 && dan[fnd] != k) cout << "0\n";
        else if(fnd == 0 && dan[fnd] == k) cout << "1\n";
        else{
            if(dan[fnd] != k) fnd--;
            long long res = (fnd == 0 ? 0 : S[fnd-1]);
            cout << res + min(k - dan[fnd] + 1, S[fnd] - res) << '\n';
        }
    }
}