import java.io.*; import java.util.*; import java.util.stream.*; 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]; for (int i = 0; i < n; i++) { points[i] = new Point(0, sc.nextInt(), sc.nextInt()); } for (int i = n; i < n + q; i++) { points[i] = new Point(i - n, sc.nextInt(), 0); } Arrays.sort(points); long[] ans = new long[q]; long leftWeight = 0; long leftSum = 0; int leftPrev = 0; for (int i = 0; i < n + q; i++) { leftSum += (points[i].position - leftPrev) * leftWeight; leftWeight += points[i].weight; leftPrev = points[i].position; if (points[i].weight == 0) { ans[points[i].idx] += leftSum; } } long rightWeight = 0; long rightSum = 0; int rightPrev = 0; for (int i = n + q - 1; i >= 0; i--) { rightSum += (rightPrev - points[i].position) * rightWeight; rightWeight += points[i].weight; rightPrev = points[i].position; if (points[i].weight == 0) { ans[points[i].idx] += rightSum; } } System.out.println(String.join("\n", Arrays.stream(ans).mapToObj(String::valueOf).toArray(String[]::new))); } static class Point implements Comparable { int idx; int position; int weight; public Point(int idx, int position, int weight) { this.idx = idx; this.position = position; this.weight = weight; } public int compareTo(Point another) { return position - another.position; } } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } 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 int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }