import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, Q = map(int, input().split()) task = [] for _ in range(N): x, w = map(int, input().split()) task.append((x, w)) for i, x in enumerate(map(int, input().split())): task.append((x, ~i)) task.sort() ans = [0] * Q def calc(): weight = 0 score = 0 now = 0 for x, i in task: d = abs(x - now) score += d * weight if i < 0: i = ~i ans[i] += score else: weight += i now = x calc() task.reverse() calc() print(*ans, sep="\n")