n, q = map(int, input().split()) info = [list(map(int, input().split())) for i in range(n)] query = list(map(int, input().split())) info = sorted(info) ans = [0] * q ind = 0 weight = 0 for i in range(q): tmp = 0 pos = query[i] if i - 1 >= 0: prv_pos = query[i - 1] else: prv_pos = pos while True: if ind >= n: break x, w = info[ind] if x <= pos: tmp += w ans[i] += w * (pos - x) ind += 1 else: break if i - 1 >= 0: ans[i] += (pos - prv_pos) * weight + ans[i - 1] weight += tmp ans2 = [0] * q ind = n - 1 weight = 0 for i in range(q)[::-1]: tmp = 0 pos = query[i] if i + 1 < q: prv_pos = query[i + 1] else: prv_pos = pos while True: if ind < 0: break x, w = info[ind] if x >= pos: tmp += w ans2[i] += w * abs(pos - x) ind -= 1 else: break if i + 1 < q: ans2[i] += abs(pos - prv_pos) * weight + ans2[i + 1] weight += tmp for i in range(q): print(ans[i] + ans2[i])