INF = 1 << 30 import bisect as bs n, q = map(int, input().split()) items = [list(map(int, input().split())) for _ in range(n)] items.append([- INF, 0]) items.append([INF, 0]) items.sort(key=lambda x: x[0]) xs = [items[i][0] for i in range(len(items))] xws = [0 for _ in range(n + 2)] ws = [0 for _ in range(n + 2)] for i in range(1, n + 2): xi, wi = items[i] xws[i] = xws[i - 1] + xi * wi ws[i] = ws[i - 1] + wi queries = list(map(int, input().split())) for i in range(q): k = bs.bisect_right(xs, queries[i]) print(xws[n] - 2 * xws[k - 1] + queries[i] * (2 * ws[k - 1] - ws[n]))