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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long n, q, x, c, e;
	bool b;
	cin >> n >> q;
	long long d[n], p[n], k[q];
	for (long long i = 0; i < n; i++){
		cin >> d[i] >> p[i];
	}
	for (long long i = 0; i < q; i++){
		cin >> k[i];
	}
	for (long long i = 0; i < q; i++){
		x = 1;
		c = 0;
		e = 0;
		b = 0;
		for (long long j = 0; j < n; j++){
			if (d[j] <= k[i]){
				e += min(c, d[j] - x);
				c -= min(c, d[j] - x);
				c += p[j];
				x = d[j];
			}
			else {
				b = 1;
				e += min(c, k[i] - x + 1);
				cout << e << "\n";
				break;
			}
		}
		if (b == 0){
			e += min(c, k[i] - x + 1);
			cout << e << "\n";
		}
	}
}