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

int main(){
	int N, Q;
	cin>>N>>Q;
	long int dani[N];
	long long int plazme[N];
	long long int pitanja[Q];
	long long int pojedeno = 0;
	for(int i = 0; i<N; i++){
		cin>>dani[i]>>plazme[i];
	}
	for(int i = 0; i<Q; i++){
		cin>>pitanja[i];
	}
	int j;
	for(int i = 0; i<Q; i++){
		j = 0;
		while(pitanja[i]>dani[j+1])
		{
			if((dani[i+1]-dani[i]+1)>plazme[i])
				pojedeno += plazme[i];	
			else if((dani[i+1]-dani[i]+1)<=plazme[i]){
				pojedeno +=  (dani[i+1]-dani[i]+1);
				plazme[i+1] += plazme[i]-(dani[i+1]-dani[i]+1);
			}
			j++;
		}
		if(pitanja[i]-dani[j]+1>plazme[j]) pojedeno += plazme[j];
		else if (pitanja[i]-dani[j]+1<=plazme[j]) pojedeno += pitanja[i]-dani[j]+1;
		cout<<pojedeno<<endl;
		
	}
}