#include<bits/stdc++.h>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n,q;
	
	cin >> n >> q;
	
	vector<long long> d (n);
	vector<long long> p (n);
	vector<long long> sum (n);
	
	cin >> d[0] >> p[0];
	sum[0] = 0;
	
	for(int i=1;i<n;i++){
		cin >> d[i] >> p[i];
		sum[i] = sum[i-1] + min(d[i] - d[i-1], p[i-1]);
		
		if(d[i]-d[i-1] < p[i-1]){
			p[i] += (p[i-1] - (d[i]-d[i-1]));
		}
	}
	
	
	long long temp;
	for(int i=0;i<q;i++){
		cin >> temp;
		
		auto it = lower_bound(d.begin(),d.end(), temp);
		
		int index  = it - d.begin();
		
		if(index == 0){
			cout << 0 << "\n";
		}
		else { 
			
			index--;
			
			cout << sum[index] + min((temp - d[index]) +1 ,p[index]) << "\n";
		}
	}
	
}