#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
	int n, q;
	cin>>n>>q;
	vector<P> v(n);
	for(int i=0; i<n; i++){
		cin>>v[i].first>>v[i].second;
	}
	sort(v.begin(), v.end());
	ll ws[100010], wxs[100010];
	ws[0]=0, wxs[0]=0;
	for(int i=0; i<n; i++){
		ws[i+1]=ws[i]+v[i].second;
		wxs[i+1]=wxs[i]+v[i].first*v[i].second;
	}
	while(q--){
		ll x;
		cin>>x;
		int k=lower_bound(v.begin(), v.end(), P(x, 0))-v.begin();
		ll ans=x*ws[k]-wxs[k]+(wxs[n]-wxs[k])-x*(ws[n]-ws[k]);
		cout<<ans<<endl;
	}
	return 0;
}