#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;

void solve() {
	int n,q;cin>>n>>q;
	vector<int> d(n+1),p(n+1),o(n+1),r(n+1),e(n+1);
	for(int i=1;i<=n;i++){
		cin>>d[i]>>p[i];
		o[i]=o[i-1]+p[i-1]+1;
		p[i]--;
		r[i]=r[i-1];
		r[i]+=max(0ll,d[i]-o[i]-r[i-1]);
		e[i]=max(0ll,d[i]-o[i]-r[i-1]);
	}
	int md=o[n]+abs(r[n])+p[n];
	while(q--){
		int k;cin>>k;
		auto lb=lower_bound(d.begin(),d.end(),k);
		if(lb==d.end()){
			cout<<max(0ll,min(md,k)-r[n]);
			continue;
		}
		int j=lb-d.begin();
		if(d[j]==k){
			cout<<k-r[j];
		}else{
			cout<<max(0ll,min(k-r[j-1],d[j]-(e[j]+1)-r[j-1]))<<'\n';
		}
	}

}
int32_t main() {
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int32_t T=1;//cin>>T;
	while(T--) {
		solve();
	}
	return 0;
}