#include <iostream>
#include <utility>
#include <vector>

using namespace std;

void pojela(unsigned long long dan, vector<pair<unsigned long long, unsigned long long> > dan_kol, int n){
	unsigned long long pocetak_intervala = dan_kol[0].first;
	unsigned long long kraj_intervala = pocetak_intervala + dan_kol[0].second - 1;	unsigned long long kolicina = dan_kol[0].second;
	unsigned long long potroseno = 0;
//	cout << "pocetak intervala: " << pocetak_intervala << " kraj_intervala " << kraj_intervala << " potroseno " << potroseno << " "<< dan << endl;
	if(n == 1 and kraj_intervala >= dan){
		cout << dan - pocetak_intervala + 1 << '\n';
	}
	else if(dan < dan_kol[0].first){
		cout << 0 << '\n';
	}
	else{
		for(int i = 1; i < n; i++){
			if(kraj_intervala >= dan){
				potroseno += dan - pocetak_intervala + 1;
				break;
			}
			if(dan_kol[i].first <= kraj_intervala){
				kraj_intervala += dan_kol[i].second;
			}
			else{
				potroseno += kraj_intervala - pocetak_intervala + 1;
				pocetak_intervala = dan_kol[i].first;
				kraj_intervala = pocetak_intervala + dan_kol[i].second - 1;
			}
//				cout << "pocetak intervala: " << pocetak_intervala << " kraj_intervala " << kraj_intervala << " potroseno " << potroseno << endl;
			if(kraj_intervala >= dan){
				potroseno += dan - pocetak_intervala + 1;
//				cout << "DA" << endl;
				break;
			}
//		cout << "pocetak intervala: " << pocetak_intervala << " kraj_intervala " << kraj_intervala << " potroseno " << potroseno << endl;
		}
		if(kraj_intervala < dan){
			potroseno += kraj_intervala - pocetak_intervala + 1;
		}
		cout << potroseno << '\n';
	}
}
int main(){
	int n, q;
	cin >> n >> q;
	vector<pair<unsigned long long, unsigned long long> > dan_kol(n);
	for(int i = 0; i < n; i++){
		cin >> dan_kol[i].first >> dan_kol[i].second;
	}
	unsigned long long dan;
	for(int i = 0; i < q; i++){
		cin >> dan;
		pojela(dan, dan_kol, n);
	}
	
	return 0;
}