#include <bits/stdc++.h>

using namespace std;

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

    long long N, Q;
    cin >> N >> Q;
    vector<long long> d;
    vector<long long> p;
    for(long long i=0; i<N; i++){
        long long d1, p1;
        cin >> d1 >> p1;
        d.push_back(d1);
        p.push_back(p1);
    }
    vector<long long> k;
    for(long long i=0; i<Q; i++){
        long long k1;
        cin >> k1;
        k.push_back(k1);
    }

    vector<long long> a;
    vector<long long> b;
    a.push_back(d[0]-1);
    b.push_back(0);
    long long r = 0;
    for(long long i=0; i<N; i++){
        if(i == (N-1)){
            a.push_back(p[i]+r);
            b.push_back(p[i]+r);
        }
        else{
            a.push_back(d[i+1] - d[i]);
            r = r + (p[i] - d[i+1] + d[i]);
            if(r <= 0){
                b.push_back(p[i]);
                r = 0;
            }
            if(r > 0){
                b.push_back(d[i+1]-d[i]);
            }
        }
    }

    for(long long i=1; i<=N; i++){
        a[i] += a[i-1];
        b[i] += b[i-1];
    }

    for(long long i=0; i<Q; i++){
        if(k[i] < a[0]){
            cout << "0\n";
        }
        else if(k[i]>a[N]){
            cout << b[N] << "\n";
        }
        else {
            long long x = lower_bound(a.begin(), a.end(), k[i]) - a.begin();
            if(a[x] == k[i]){
                cout << b[x] << "\n";
            }
            else{
                if((b[x]-b[x-1]) >= (k[i]-a[x-1])){
                    cout << b[x-1]+k[i]-a[x-1] << "\n";
                }
                else{
                    cout << b[x] << "\n";
                }
            }
        }
    }
    return 0;
}