#include using namespace std; inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template inline string toString(T x) {ostringstream sout;sout< VI; typedef vector VVI; typedef vector VS; typedef pair P; typedef tuple tpl; #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SORT(c) sort((c).begin(),(c).end()) #define REVERSE(c) reverse((c).begin(),(c).end()) #define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin() #define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin() #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i) #define RREP(i,n) RFOR(i,n,0) #define en "\n" const double EPS = 1e-9; const double PI = acos(-1.0); const int INT_INF = 2147483647; const long long LL_INF = 1LL<<60; const long long MOD = 1000000007; #define CLR(a) memset((a), 0, sizeof(a)) #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } int main(void){ ll N,Q; cin >> N >> Q; vector> v(N); REP(i,N) cin >> v[i].first >> v[i].second; SORT(v); vector xw(N+1), w(N+1); xw[0] = 0; REP(i,N) xw[i+1] = xw[i] + v[i].first*v[i].second; w[0] = 0; REP(i,N) w[i+1] = w[i] + v[i].second; auto lb = [&](ll val){ ll l = -1, r = N, n = (l+r)/2; while(r-l>1){ if(v[n].first < val) l = n; else r = n; n = (l+r)/2; } return r; }; REP(i,Q){ ll X; cin >> X; ll it = lb(X); ll L = xw[it] - X*w[it]; ll R = (xw[N]-xw[it]) - X*(w[N]-w[it]); cout << R-L << en; } return 0; }