#include <iostream>

using namespace std;

int min(long long x, long long y){
  if (x < y) return x;
  return y;
}

int main() {
	int N, Q;
	int p[300000];
	long long d[300000];
	long long k[300000][2];
	cin >> N >> Q;
	for (int i = 0; i < N; i++) {
		cin >> d[i] >> p[i];
	}
	for (int i = 0; i < Q; i++) {
		cin >> k[i][0];
	}
	int j1 = 0, j2 = 0;
	long long count = 0, eten = 0;
	for (long long i = 0; i < 1000000000000000000; i++) {
		if (i == d[j1]) {
			count += p[j1];
			j1++;
		}
		if (count > 0) {
			count--;
			eten++;
		}
		if (j1 == N){
		  for (j2; j2 < Q; j2++){
		    if (k[j2][0] - i < count){
		      eten += k[j2][0] - i;
		      count -= k[j2][0] - i;
		    }
		    else{
		      eten += count;
		      count = 0;
			   }
			  i = k[j2][0];
			  k[j2][1] = eten;
			 }
			 break;
		}
		if (i == k[j2][0]) {
			k[j2][1] = eten;
			j2++;
			if (j2 == Q) break;
		}
	}
	for (int i = 0; i < Q; i++) {
		cout << k[i][1] << endl;
	}
}