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

using namespace std;

void pojela(unsigned long long dan, vector<pair<unsigned long long, unsigned long long> > dan_kol, int n){
	unsigned long long trenutno = 0;
	unsigned long long j = 0;
	unsigned long long i = dan_kol[0].first;
	unsigned long long brojac = 0;
	for(i; i <= dan; i++){
		if(i == dan_kol[j].first and j < n){
			trenutno += dan_kol[j].second;
			j++;
		}
//		cout << trenutno << " ";
		if(trenutno > 0){
			trenutno--;
			brojac++;
		}
//		cout << i << " " << brojac << " " << trenutno << endl;
	}
	cout << brojac << "\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;
}