from bisect import * N,Q=map(int, input().split()) data=[] X=[] for _ in range(N): x,w=map(int, input().split()) data.append((x,w)) X.append(x) X.sort() data.sort(key=lambda x:x[0]) S=[0] T=[0] for x,w in data: S.append(S[-1]+w) T.append(T[-1]+x*w) for x in map(int, input().split()): i=bisect_left(X,x) print(S[i]*x-T[i] + (T[-1]-T[i])-x*(S[-1]-S[i]))