#include <bits/stdc++.h>
#include <map>
#define ll long long
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
	ll n,q,s=0;cin>>n>>q;
	vector<pair<ll,ll> >vec(n+1),vec1(n+1);
	for(ll i=1;i<=n;i++){
		ll a,b;cin>>a>>b;
		s+=b;
		vec[i]={a,s};
		//cout<<vec[i].first<<" "<<vec[i].second<<endl;
		
	}
	int korisni=0;
	for(ll i=1;i<=n;i++){
		//cout<<(vec[i].first-vec[i-1].first)<<endl;
		if(vec[i-1].second-korisni<=(vec[i].first-vec[i-1].first+1))
			{
				korisni+=vec[i-1].second-korisni;
			}
		else {
			korisni+=(vec[i].first-vec[i-1].first+1);
			vec[i-1].second-=korisni;
		}
		//cout<<vec[i].second<<endl;
		vec1[i]={vec[i].first,korisni};
		//cout<<vec1[i].first<<vec1[i].second<<endl;
		//cout<<korisni<<endl;
		
		
	}
	while(q--){
		ll a;cin>>a;
		ll l=1,r=n,ans = -1;
		while(l<=r){
			int mid = (l + r) / 2;
			if(vec[mid].first <= a){
				l=mid + 1;
				ans = mid;
			}
			else {
				 r = mid - 1; 
			}
		}
		if(ans==-1)cout<<0<<endl;
		else{
			//cout<<ans<<endl;
			//cout<<vec1[ans].second<<endl;
			//cout<<(a-vec[ans].first+1)<<" "<<vec[ans].second<<endl;
			cout<<min((vec1[ans].second+min((a-vec[ans].first+1),vec[ans].second)),vec[ans].second)<<endl;
		}
	}
	return 0;
}