#include <iostream>

int main() {
	int n, q;
	std::cin >> n >> q;
	long long* kupio = (long long*)malloc(n * sizeof(long long));
	long long* kolicina = (long long*)malloc(n * sizeof(long long));

	long long pd = 0;
	for (int i = 0; i < n;i++) {
		long long d;
		long long p;
		std::cin >> d >> p;

		pd = std::max(pd - d, (long long)0);
		kupio[i] = pd + d;
		kolicina[i] = pd + d + p;
		pd = d + p;
	}
	long long* pitanja = (long long*)malloc(q * sizeof(long long));
	for (int i = 0;i < q; i++) {
		long long k;
		std::cin >> k;
		pitanja[i] = k;
	}
	for (int i = 0; i < q; i++) {
		long long zbir = 0;

		int j = 0;
		while (j < n && kupio[j] <= pitanja[i]) {
			if (kolicina[j] > pitanja[i]) {
				zbir += pitanja[i] - kupio[j] + 1;
				break;
			}
			zbir += kolicina[j] - kupio[j];
			j++;
		}
		std::cout << zbir << std::endl;
	}
	return 0;
}