#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],pref[n+1];
    pref[0]=dan[0]=kol[0]=0;
    for(int i=1;i<=n;i++)cin>>dan[i]>>kol[i];
    int sum=0;
    for(int i=1;i<=n;i++){
        pref[i]=pref[i-1]+kol[i];
        if(dan[i-1]+kol[i-1]>dan[i]){
            pref[i-1]-=(dan[i-1]+kol[i-1])-dan[i];
        }
    }
    while(q--){
        int x;
        cin>>x;
        int ind=(upper_bound(dan+1,dan+n+1,x)-dan)-1;
        if(ind==0)cout<<0<<endl;
        if(x>dan[n]+pref[n])cout<<pref[n]<<endl;
        else{
            int res=pref[ind-1];
            res+=min(pref[ind],x-dan[ind]+1);
            cout<<res<<endl;
        }
    }
    return 0;
}