#include <bits/stdc++.h>
#define lli long long int

using namespace std;

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	
	int N, Q;
	cin>>N>>Q;
	
	lli days[N], amounts[N];
	for(int i = 0; i < N; i++){
		cin>>days[i]>>amounts[i];
	}
	
	lli questions[Q];
	for(int i = 0; i < Q; i++){
		cin>>questions[i];
	}



	int dIndex = 0;

	lli total = 0;
	lli lastAmount = 0;
	lli overflow = 0;
	lli lastDay = 0;
	
	for(int qIndex = 0; qIndex < Q; qIndex++){
		
		lli day = questions[qIndex];
		while(dIndex < N && days[dIndex] <= day){
			if(dIndex > 0){
				lli diff = days[dIndex] - lastDay;
				
				if(diff > lastAmount){
					lli needed = diff - lastAmount;
					if(needed > overflow) needed = overflow;
					overflow -= needed;
					total += needed + lastAmount;
				}else if(diff == lastAmount){
					total += lastAmount;
				}else{
					total += diff;
					overflow += lastAmount - diff;
				}	
			}
			
			lastAmount = amounts[dIndex];
			lastDay = days[dIndex];
			
			dIndex++;
		}
		
		lli out = total;
		lli diff = day - lastDay + 1;
		if(diff <= (lastAmount + overflow)){
			out += diff;
		}else {
			out += lastAmount + overflow;
		}
		
		cout<<out<<endl;
	}
	
	return 0;
}