#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int N = 2e5 + 20;

void solve()
{
    ll n,q;
    cin >> n >> q;
    vector<ll> a(n);
    vector<ll> b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        cin >> b[i];
    }

    vector<ll> pref(n);

    pref[0]=b[0];

    for(int i = 1; i < n; i++){
        pref[i]= pref[i-1]+b[i];
    }



    while(q--){
        ll k;
        cin >> k;
        auto x = lower_bound(a.begin(),a.end(),k)-a.begin();

        if(x==n){
            x--;
        }

        if(a[x] > k && x!=0){
            x--;
        }
        if(a[x] > k && x==0){
            cout << 0 << "\n";
            continue;
        }

        if(x==0){
            cout << min(b[x],(k-a[x])+1) << "\n";
            continue;

        }
       // cout << "x: " << x << "\n";
        bool check = false;

        ll ans = 0;

        //cout << "dan: " << a[x] << "\n";

        if(a[n-1] < k){
            //x--;
        }

        if(pref[x-1] >= a[x]-1){
            ans+=a[x];
            check = true;
        }else if(pref[x-1] < a[x]-1){
            ans+=pref[x-1];
        }

        //cout << "ans: " << ans << "\n";

        //cout << "1\n";

        if(!check){
            if(b[x] >= (k-a[x])){
                ans+=(k-a[x])+1;
                //cout << "1\n";
            }else{
                ans+=b[x];
                //cout << "2\n";
            }
        }else{
            if(b[x]+(pref[x-1]-(a[x]-1)) >= (k-a[x])){
                ans+=(k-a[x])+1;
                //cout << "3\n";
            }else{
                //cout << a[x] << "\n";
                ans+=(b[x]+(pref[x-1]-(a[x])));
                //cout << "4\n";
            }
        }
        cout << ans << "\n";




    }



}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t = 1;
    //cin >> t;
    while(t--){
        solve();
    }

}