#include <iostream>

using namespace std;

long long int a[2][300000];

int f(int n, long long int t)
{
	int l = 0, h = n - 1;
	if (t > a[0][n - 1]) return n - 1;
	if (t < a[0][0]) return - 1;
	while (l <= h)
	{
		int m = l + (l + h) / 2;
		if (t < a[0][m] && t > a[0][m - 1]) return m - 1;
		if ((t > a[0][m] && t < a[0][m + 1]) || t == a[0][m]) return m;
		else if (t < a[0][m]) h = m - 1;
		else l = l + 1;
	}
}
long long int ff(long long int k, int n, long long u)
{
	long long r = a[1][n];
	if (k - a[0][n]+1 <= u - a[1][n]) r += k - a[0][n]+1;
	else r += u - a[1][n];
	return r;
}
int main()
{
	long long int k, u = 0, z;
	int n, q;
	cin >> n >> q;
	for (int i = 0; i < n; i++)
	{
		cin >> a[0][i];
		cin >> z;
		if(u<= a[0][i]) a[1][i]=u;
		else a[1][i] = a[0][i]-1;
		u += z;
	}

	for (int i = 0; i < q; i++)
	{
		cin >> k;
		if (f(n, k) == -1)
		{
			cout << 0 << endl;
		}
		else cout << ff(k, f(n, k),u) << endl << endl;
	}

}