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(); Point[] points = new Point[n + q + 2]; for (int i = 1; i <= n; i++) { points[i] = new Point(sc.nextInt(), sc.nextInt(), true); } for (int i = 0; i < q; i++) { points[i + n + 1] = new Point(sc.nextInt(), i, false); } points[0] = new Point(0, 0, true); points[n + q + 1] = new Point(Integer.MAX_VALUE, 0, true); Arrays.sort(points); long[] ans = new long[q]; long total = 0; long weight = 0; for (int i = 1; i <= n + q; i++) { total += weight * (points[i].position - points[i - 1].position); if (points[i].isThing) { weight += points[i].value; } else { ans[points[i].value] += total; } } total = 0; weight = 0; for (int i = n + q; i >= 1; i--) { total += weight * (points[i + 1].position - points[i].position); if (points[i].isThing) { weight += points[i].value; } else { ans[points[i].value] += total; } } StringBuilder sb = new StringBuilder(); for (long x : ans) { sb.append(x).append("\n"); } System.out.print(sb); } static class Point implements Comparable { int position; int value; boolean isThing; public Point(int position, int value, boolean isThing) { this.position = position; this.value = value; this.isThing = isThing; } public int compareTo(Point another) { return position - another.position; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); 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 { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }