#!/usr/bin/env python3 import sys input = sys.stdin.readline import bisect n, q = map(int, input().split()) places = [] r_x = [0] * n r_1 = [0] * n l_x = [0] * n l_1 = [0] * n xw = [] for i in range(n): x, w = map(int, input().split()) xw.append((x, w)) xw.sort() for i, (x, w) in enumerate(xw): places.append(x) r_x[i] = w l_x[i] = -w r_1[i] = -(x * w) l_1[i] = x * w r_x_cum = [0] r_1_cum = [0] for item in r_x: r_x_cum.append(r_x_cum[-1] + item) for item in r_1: r_1_cum.append(r_1_cum[-1] + item) l_x_cum = [0] l_1_cum = [0] for item in l_x[::-1]: l_x_cum.append(l_x_cum[-1] + item) for item in l_1[::-1]: l_1_cum.append(l_1_cum[-1] + item) q = [int(item) for item in input().split()] for np in q: r_index = bisect.bisect_left(places, np) l_index = n - r_index ans = r_x_cum[r_index] * np + r_1_cum[r_index] ans += l_x_cum[l_index] * np + l_1_cum[l_index] print(ans)