#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	long long n = 0, q = 0, sum1 = 0, sum2 = 0;
	cin >> n >> q;
	vector<long long> d(n);
	vector<long long> p(n);
	vector<long long> pit(q);
	for (long long i = 0; i < n; i++)
	{
		cin >> d[i] >> p[i];
		sum1 += d[i];
		sum2 += p[i];
	}
	for (long long a = 0; a < q; a++)
		cin >> pit[a];
	vector<bool> m1(sum1 + sum2);
	for (long long m = 0; m < n; m++)
	{
		long long dan = d[m] - 1;
		long long pla = p[m] + dan;
		for (long long i = dan; i < pla; i++)
		{
			if (m1[i] == true)
			{
				pla++;
				continue;
			}
			else
				m1[i] = true;
		}
	}
	for (long long i = 0; i < q; i++)
	{
		int sumf = 0;
		for (long long m = 0; m < pit[i]; m++)
		{
			if (m1[m])
				sumf++;
		}
		cout << sumf << endl;
	}


	return 0;
}