#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define endl "\n"
void solve(){
    int n,q;cin>>n>>q;
    vector<ll>dani(n),dobila(n),pojela(n);
    for(int i=0;i<n;i++){cin>>dani[i]>>dobila[i];}
    for(int i=0;i<n-1;i++){
        if(dobila[i]>dani[i+1]-dani[i]){
            pojela[i+1]=pojela[i]+(dani[i+1]-dani[i]);
            dobila[i+1]+=dobila[i]-(dani[i+1]-dani[i]);
        }
        else{
            pojela[i+1]=pojela[i]+dobila[i];
        }
    }
    while(q--){
        ll k;cin>>k;
        auto iter=upper_bound(dani.begin(),dani.end(),k)-dani.begin();
        if(iter==0){cout<<"0\n";continue;}
        iter--;
        ll ans=pojela[iter]+min(k+1LL-dani[iter],dobila[iter]);
        cout<<ans<<endl;
    }
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int t=1;//cin>>t;
    while(t--)solve();
    return 0;
}