import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int q = sc.nextInt(); Thing[] things = new Thing[n]; for (int i = 0; i < n; i++) { things[i] = new Thing(sc.nextInt(), sc.nextInt()); } Arrays.sort(things); TreeMap lefts = new TreeMap<>(); long leftCost = 0; long leftWeights = 0; int prev = Integer.MIN_VALUE; lefts.put(Integer.MIN_VALUE, new Current(leftCost, leftWeights)); for (int i = 0; i < n; i++) { leftCost += (things[i].point - prev) * leftWeights; leftWeights += things[i].weight; lefts.put(things[i].point, new Current(leftCost, leftWeights)); prev = things[i].point; } TreeMap rights = new TreeMap<>(); long rightCost = 0; long rightWeights = 0; prev = Integer.MAX_VALUE; rights.put(Integer.MAX_VALUE, new Current(rightCost, rightWeights)); for (int i = n - 1; i >= 0; i--) { rightCost += (prev - things[i].point) * rightWeights; rightWeights += things[i].weight; rights.put(things[i].point, new Current(rightCost, rightWeights)); prev = things[i].point; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { int x = sc.nextInt(); long ans = 0; int min = lefts.floorKey(x); ans += lefts.get(min).cost + lefts.get(min).weight * (x - min); int max = rights.ceilingKey(x); ans += rights.get(max).cost + rights.get(max).weight * (max - x); sb.append(ans).append("\n"); } System.out.print(sb); } static class Thing implements Comparable { int point; int weight; public Thing(int point, int weight) { this.point = point; this.weight = weight; } public int compareTo(Thing another) { return point - another.point; } } static class Current { long cost; long weight; public Current(long cost, long weight) { this.cost = cost; this.weight = weight; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }