#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	int n,q,i;
	scanf("%d %d",&n,&q);
	int d[n],p[n],pit,odg[q];
	for(i=0;i<n;i++)
	{
		scanf("%d %d",&d[i],&p[i]);
	}
	for(i=0;i<q;i++)
	{
		int j=0;
		odg[i]=0;
		scanf("%d",&pit);
		while(d[j]<=pit && odg[i]<pit && j<n)
		{
			if(d[j]==pit)
				odg[i]++;
			else if((d[j]+odg[i]+p[j])>pit)
				odg[i]+=pit-d[j]+1;
			else
				odg[i]+=p[j];
			j++;
		}
	}
	for(i=0;i<q;i++)
		printf("%d\n",odg[i]);

	return 0;
}