#include <bits/stdc++.h>
#define endl '\n'
#define int long long

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,q;
    cin>>n>>q;
    int dan[n+1],kol[n+1],state[n+2],pref[n+2];
    state[0]=pref[0]=dan[0]=kol[0]=0;
    for(int i=1;i<=n;i++)cin>>dan[i]>>kol[i];
    for(int i=1;i<=n;i++){
        state[i]=max(0LL,state[i-1]-(dan[i]-dan[i-1]))+kol[i];
        pref[i]=pref[i-1]+min(dan[i]-dan[i-1], state[i-1]);
    }
    while(q--){
        int x;
        cin>>x;
        int ind=(lower_bound(dan+1,dan+n+1,x)-dan)-1;
        int res=pref[ind];
        res+=min(state[ind],x-dan[ind]+1);
        cout<<res<<endl;
    }
    return 0;
}