import bisect N,Q=map(int,input().split()) XW=[] for i in range(N): x,w=map(int,input().split()) XW.append((x,w)) XW.sort() X,W=[],[] for x,w in XW: X.append(x) W.append(w) C0=[0]+W C1=[0]+[x*w for x,w in zip(X,W)] for i in range(1,N+1): C0[i]+=C0[i-1] C1[i]+=C1[i-1] for x in map(int,input().split()): i=bisect.bisect(X,x) ans=x*C0[i]-C1[i]+(C1[N]-C1[i])-x*(C0[N]-C0[i]) print(ans)