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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, q;
	cin >> n >> q;
	
	vector<long long> dani(n), plazma(n);
	
	for(int i = 0; i < n; i++)
		cin >> dani[i] >> plazma[i];
		
	vector<long long> zbir_plazmi(n);
	zbir_plazmi[0] = plazma[0];
	
	for(int i = 1; i < n; i++)
		zbir_plazmi[i] = zbir_plazmi[i-1] + plazma[i];
		
	for(int i = 0; i < q; i++){
		long long upit;
		cin >> upit;
		
	int index_najblizeg_dana = upper_bound(dani.begin(), dani.end(), upit) - dani.begin()-1;
	
	long long plazma_do_upita;
	
	if(index_najblizeg_dana >= 0){
		plazma_do_upita = zbir_plazmi[index_najblizeg_dana];
		
		long long pojela;
		
		if(index_najblizeg_dana == 0)
			pojela = min(plazma_do_upita, upit+1-dani[index_najblizeg_dana]);
		else
			pojela = min(plazma_do_upita, upit+1+zbir_plazmi[index_najblizeg_dana-1]-dani[index_najblizeg_dana]);
			
		cout << pojela << '\n';
	}
	else{
		plazma_do_upita = 0;
		cout << 0 << '\n';
	}
	}
	
	return 0;
}