#include <iostream> 
#include <map>
using namespace std;
map <unsigned long long, unsigned> Nabavka;
map <unsigned long long, unsigned>::iterator it, pom;
unsigned long long ispis[300000];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	unsigned n, q = 300000, p, prethodni;
	
	unsigned long long d, k = 0, suma = 0, suma_pojedenih = 0;
	
	cin >> n >> q;

	for (int i = 0; i < n; i++) {
		cin >> d >> p;
		Nabavka.insert(make_pair(d, p));
	}
	
	it = Nabavka.begin();
	pom = it;
	pom++;
	prethodni = it->first;


	int ostatak = 0;
	for (int j = 0; j < q; j++) {
		suma = 0;
		cin >> k;
		int br_plazmi = it->second;
		if (k >= it->first) {
			for (; pom != Nabavka.end() && pom->first <= k; pom++) {
				
				if (br_plazmi > pom->first - it->second + 1) {
					suma += pom->first - it->second + 1;
					br_plazmi -= (pom->first - it->second + 1);
				}

				else {
					suma += br_plazmi;
					br_plazmi = 0;
				}

				it++;
				br_plazmi += it->second;
			}

			if (br_plazmi > k - it->first + 1) {
				suma += k - it->first + 1;
				br_plazmi -= k - it->first + 1;
			}
			else {
				suma += br_plazmi;
				br_plazmi = 0;
			}
			ispis[j] = suma;
		}
		else ispis[j] = 0;
	}

	for (int j = 0; j < q; j++) cout << ispis[j] << "\n";
	return 0;
}