#include<iostream>
#include<map>
#include<vector>
#define int long long
using namespace std;
signed main() {
	ios_base::sync_with_stdio(false);
	int n, q;cin >> n >> q;
	map<int, int> m;
	vector<int> dani;
	for (int i = 0;i < n;i++) {
		int a, b; cin >> a >> b;
		m[a] += b;
		dani.push_back(a);
	 }
	int brojilac = 0;
	int plazma = 0;
	int pojedeno = 0;
	while (q--) {
		int k;cin >> k;
		for (int i = brojilac;i < n && dani[i] <= k;i++) {
			plazma += m[dani[i]];
			if (i != n - 1) {
				pojedeno += min(plazma, min(dani[i + 1] - dani[i] + 1,k - dani[i] + 1));
				plazma -= min(plazma, min(dani[i + 1] - dani[i] + 1, k - dani[i] + 1));
			}
			else {
				pojedeno += min(plazma,k - dani[i] + 1);
				plazma -= min(plazma, k - dani[i] + 1);
			}
			
			brojilac++;
		}
		cout << pojedeno << "\n";
	}
	
}
/*if (k - dani[i] + 1 >= plazma) {
	pojedeno += plazma;
	plazma = 0;
}
else {
	pojedeno += k - dani[i] + 1;
	plazma -= k - dani[i] + 1;
}
2
1
1 6
5 3
6

*/