#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    long long int N, P, k = 0;
    
    cin >> N >> P;
    
	vector<long long int> pitanja(P);
    vector<long long int> dani(N), paketi(N);
    
    for (int i = 0; i < N; i++) {
        cin >> dani[i] >> paketi[i];
    }
	for (int i = 0; i < P; i++) {
        cin >> pitanja[i];
    }
    
    long long int pojedeno = 0;
	long long int full = 0;
	int i=0;
	
	for(k = 0; k < P; k++){
	long long int tren = pitanja[k];
	
		while(i < N && dani[i] <= tren){
			full += paketi[i];
			i++;
		}
		
		long long int mog = tren - pojedeno;

		long long int stv = full - mog;
		
		pojedeno += stv;
		full -= stv;
		
		cout << stv << '\n';
		
	}
	return 0;
}