#include <iostream>
#include <vector>

using namespace std;
int main(int argc, char** argv) {
	ios_base::sync_with_stdio(false);
	
	unsigned long long int n,q;
	cin >>n>>q;
	vector<pair<unsigned long long int,unsigned long long int> > plazme(n);
	for(int i=0;i<n;i++)
	{
		cin >>plazme[i].first>>plazme[i].second;
	}
	vector<unsigned long long int> dani(q);
	for(int i=0;i<q;i++)
	{
		cin >>dani[i];
	}
	plazme.push_back(make_pair(1000000000000000002,0));
	unsigned long long int pojedeno=0,raspolaganje=0;
	unsigned long long int pplazme=0,pdani=0;
	unsigned long long int pretdan=0;
	while(pdani<q)
	{
		if(plazme[pplazme].first<=dani[pdani])
		{
			pojedeno+=min(raspolaganje,plazme[pplazme].first-pretdan+1);
			raspolaganje-=min(raspolaganje,plazme[pplazme].first-pretdan+1);
			raspolaganje+=plazme[pplazme].second;
			pretdan=plazme[pplazme].first;
			pplazme++;
		}
		else
		{
			pojedeno+=min(raspolaganje,dani[pdani]-pretdan+1);
			raspolaganje-=min(raspolaganje,dani[pdani]-pretdan+1);
			cout <<pojedeno<<"\n";
			pretdan=dani[pdani];
			pdani++;
		}
	}
	
	return 0;
}