#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    
	int n, q;
	cin >> n >> q;
	long long d[n], p[n+1] = {0};
	long long k[q];
	int indeks1 = 0, indeks2;
	long long zaliha=0, pojela=0;
	for (int i=0; i<n; i++)
	{
		cin >> d[i] >> p[i];
	}
	for (int i=0; i<q; i++)
	{
		cin >> k[i];
	}
	for (int i=0; i<q; i++)
	{
		indeks2 = lower_bound(d, d+n, k[i]) - d;
		for (int j=indeks1; j<indeks2; j++)
		{
			zaliha += p[j];
			if (k[i] - d[j] < zaliha) 
			{
				pojela += k[i] - d[j] + 1;
				zaliha -= k[i] - d[j] + 1;
			}
			else
			{
				pojela += zaliha;
				zaliha = 0;
			}
		}
		if (d[indeks2] == k[i] && p[indeks2] > 0)
			cout << pojela + 1 << endl;
		else
			cout << pojela << endl;
		
		indeks1 = indeks2;
	}
	return 0;
}