#include <bits/stdc++.h>
using namespace std;

#define int long long
const int N=3e5+4;
int d[N],p[N],pref[N],n,q;

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin>>n>>q;
    for(int i=0;i<n;++i)
    	cin>>d[i]>>p[i];

    for(int i=0;i+1<n;++i){
    	if(d[i]+p[i]-1>=d[i+1]){
    		p[i+1]+=p[i]+d[i]-d[i+1];
    		p[i]-=p[i]+d[i]-d[i+1];
    	}
    }

    pref[0]=p[0];
    for(int i=1;i<n;++i)
    	pref[i]=pref[i-1]+p[i];

    while(q--){
    	int k;
    	cin>>k;
    	if(k<d[0]){
    		cout<<0<<'\n';
    		continue;
    	}
    	int id=upper_bound(d,d+n,k)-d-1;
    	int ans=(id?pref[id-1]:0);
    	int raz=k-d[id]+1;
    	ans+=min(raz,p[id]);
    	cout<<ans<<'\n';
    }
}