import sys input = sys.stdin.buffer.readline N, Q = map(int, input().split()) freight = [tuple(map(int, input().split())) for _ in range(N)] X = tuple(map(int, input().split())) cost_x0 = sum(x * w for x, w in freight) queries = [] for x, w in freight: queries.append((x, 1, w)) for i, x in enumerate(X): queries.append((x, 2, i)) queries.sort() cost = cost_x0 cur_idx = 0 left_weight, right_weight = 0, sum(w for _, w in freight) ans = [0] * Q for q in queries: x = q[0] cost += left_weight * (x - cur_idx) cost -= right_weight * (x - cur_idx) cur_idx = x if q[1] == 1: left_weight += q[2] right_weight -= q[2] else: # assert q[1] == 2 ans[q[2]] = cost print(*ans, sep='\n')