import java.io.*;
import java.util.*;

public class dunes_md {
	public void run() {
		int n = in.nextInt();
		int m = in.nextInt();
		int[] from = new int[n];
		int[] to = new int[n];
		int[] x = new int[n];
		for (int i = 0; i < n; i++) {
			from[i] = in.nextInt();
			to[i] = in.nextInt() + 1;
			x[i] = in.nextInt();
		}
		for (int i = 0; i < m; i++) {
			int q = in.nextInt();
			int h = 0;
			for (int j = 0; j < n; j++) {
				if (from[j] <= q && q < to[j]) {
					if (q % 2 == from[j] % 2) {
						h += x[j];
					} else {
						h -= x[j];
					}
				}
			}
			out.println(h);
		}
	}

	private static String fileName = dunes_md.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
	private static String inputFileName = fileName + ".in";
	private static String outputFileName = fileName + ".out";
	private static Scanner in;
	private static PrintWriter out;
	
	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		in = new Scanner(new File(inputFileName));
		out = new PrintWriter(outputFileName);
		new dunes_md().run();
		in.close();
		out.close();
	}
}
