#include <iostream>
using namespace std;

int main()
{
	int n, q, p;
	long d;
	cin >> n >> q;
	long long* days = new long long[n + 2];
	int* amounts = new int[n + 1];
	days[0] = 0;
	amounts[0] = 0;
	for (int i = 1; i < n + 1; i++) {
		cin >> d >> p;
		days[i] = d;
		amounts[i] = p;
	}
	for (int i = 0; i < q; i++) {
		long long sum = 0;
		long long stockpile = 0;
		long long k;
		cin >> k;
		days[n + 1] = k + 1;
		for (int j = 1; j < n + 2; j++) {
			if (k >= days[j]) {
				if (amounts[j - 1] > days[j] - days[j - 1]) {
					stockpile += amounts[j - 1] - (days[j] - days[j - 1]);
					sum += days[j] - days[j - 1];
				}
				else {
					if (stockpile + amounts[j - 1] <= days[j] - days[j - 1]) {
						sum += amounts[j - 1] + stockpile;
						stockpile = 0;
					}
					else {
						sum += days[j] - days[j - 1];
						stockpile += amounts[j - 1] - (days[j] - days[j - 1]);
					}
				}
			}
			else {
				if (stockpile + amounts[j - 1] >= (k + 1) - days[j - 1]) {
					sum += (k + 1) - days[j - 1];
				}
				else {
					sum += stockpile + amounts[j - 1];
				}
				break;
			}
		}
		cout << sum << endl;
	}
}