import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); Pack[] packs = new Pack[n + 2]; for (int i = 0; i < n; i++) { packs[i] = new Pack(sc.nextInt(), sc.nextInt()); } packs[n] = new Pack(0, 0); packs[n + 1] = new Pack(Integer.MAX_VALUE, 0); Arrays.sort(packs); long[] leftWeight = new long[n + 2]; long[] leftCosts = new long[n + 2]; leftWeight[0] = packs[0].weight; for (int i = 1; i < n + 2; i++) { leftWeight[i] = leftWeight[i - 1] + packs[i].weight; leftCosts[i] = leftCosts[i - 1] + (packs[i].point - packs[i - 1].point) * leftWeight[i - 1]; } long[] rightWeight = new long[n + 2]; long[] rightCosts = new long[n + 2]; rightWeight[n + 1] = packs[n + 1].weight; for (int i = n; i >= 0; i--) { rightWeight[i] = rightWeight[i + 1] + packs[i].weight; rightCosts[i] = rightCosts[i + 1] + (packs[i + 1].point - packs[i].point) * rightWeight[i + 1]; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { int x = sc.nextInt(); int left = 0; int right = n + 1; while (right - left > 1) { int m = (left + right) / 2; if (packs[m].point <= x) { left = m; } else { right = m; } } long ans = leftCosts[left] + leftWeight[left] * (x - packs[left].point) + rightCosts[right] + rightWeight[right] * (packs[right].point - x); sb.append(ans).append("\n"); } System.out.print(sb); } static class Pack implements Comparable { int point; int weight; public Pack(int point, int weight) { this.point = point; this.weight = weight; } public int compareTo(Pack another) { return point - another.point; } } }