N,Q = map(int,input().split()) l = [] for _ in range(N): x,w = map(int,input().split()) l.append((x,w)) l.sort(key = lambda x:x[0]) X = list(map(int,input().split())) X = [(X[i],i) for i in range(Q)] ans = [0] * Q X.sort(key = lambda s:s[0]) hidari = [0] * (N+1) migi = [0] * (N+1) for i in range(N): hidari[i+1] = hidari[i] + l[i][1] for i in range(N-1,-1,-1): migi[i] = migi[i+1] + l[i][1] a = 0 x = X[0][0] index = X[0][1] for i in range(N): s,w = l[i] a += abs(s-x) * w ans[index] = a left = 0 now = x for i in range(1,Q): x,index = X[i] while left < N and l[left][0] <= now: left += 1 delta = x - now a += delta * hidari[left] right = left while right < N and l[right][0] <= x: a -= (l[right][0] - now) * l[right][1] a += (x - l[right][0]) * l[right][1] right += 1 a -= delta * migi[right] ans[index] = a now = x print(*ans,sep="\n")