#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
const long long mod = 1000000007;

struct D {
	int t, s = -1;
	bool operator<(const int o)const {
		return t < o;
	}
	bool operator==(const int o)const {
		return t == o;
	}
};

struct STX
{
	int s, t, x;
	bool operator<(const STX&o)const {
		return x < o.x;
	}
};

template<class T>
class ErasableSortedArray {

	int n;
	int level;
	T* data;
	int *prev, *next;
	bool *eraced;
	int **ctree;

public:
	ErasableSortedArray(T* data, int n) :data(data), n(n) {
		for (int i = 0; i < 31; i++) {
			if (n >> i == 0) {
				level = i + 1;
				break;
			}
		}
		ctree = new int*[level];
		for (int i = 0; i < level; i++) {
			ctree[i] = new int[((n - 1) >> i) + 1];
			for (int j = 0; j < ((n - 1) >> i) + 1; j++) {
				if (i == 0)ctree[0][j] = 1;
				else {
					if ((j << i) + (1 << (i - 1)) >= n) {
						ctree[i][j] = ctree[i - 1][j << 1];
					}
					else {
						ctree[i][j] = ctree[i - 1][j << 1] + ctree[i - 1][(j << 1) + 1];
					}
				}
			}
		}
		prev = new int[n];
		next = new int[n];
		eraced = new bool[n];
		for (int i = 0; i < n; i++) {
			prev[i] = i - 1;
			next[i] = i + 1;
			eraced[i] = false;
		}
	}
	~ErasableSortedArray() {
		for (int i = 0; i < level; i++) {
			delete[] ctree[i];
		}
		delete[] ctree;
		delete[] prev;
		delete[] next;
	}

	T& operator[](int i) {
		return data[i];
	}

	int Next(int i) {
		if (!eraced[i])return next[i];
		for (int l = 1; l < level; l++) {
			if ((i&(1 << (l - 1))) == 0) {
				if (ctree[l][i >> l] != ctree[l - 1][i >> (l - 1)]) {
					int r = (i >> (l - 1)) + 1;
					for (int m = l - 2; m >= 0; m--) {
						r <<= 1;
						if (ctree[m][r] == 0) {
							r |= 1;
						}
					}
					return r;
				}
			}
		}
		return n;
	}

	int Prev(int i) {
		if (!eraced[i])return prev[i];
		for (int l = 1; l < level; l++) {
			if ((i&(1 << (l - 1))) == 1) {
				if (ctree[l][i >> l] != ctree[l - 1][i >> (l - 1)]) {
					int r = (i >> (l - 1));
					for (int m = l - 2; m >= 0; m--) {
						r <<= 1;
						if (ctree[m][r | 1] != 0) {
							r |= 1;
						}
					}
					return r;
				}
			}
		}
		return -1;
	}

	void Erace(int i) {
		if (eraced[i])return;
		eraced[i] = true;
		for (int l = 0; l < level; l++) {
			ctree[l][i >> l]--;
		}
		if (prev[i] != -1)next[prev[i]] = next[i];
		if (next[i] != n)prev[next[i]] = prev[i];
	}

	template<class T2>
	int Search(T2 t, char mode = 'j') {
		switch (mode) {
		case 'p':
			if (data[0] == t) {
				if (!eraced[0])return 0;
				else return -1;
			}
			if (!(data[0] < t))return -1;
			if (data[n - 1] < t) {
				if (!eraced[n - 1])return n - 1;
				else return Prev(n - 1);
			}
			break;
		case 'n':
			if (data[0] == t || !(data[0] < t)) {
				if (!eraced[0])return 0;
				else return Next(0);
			}
			if (data[n - 1] < t)return n;
			break;
		default:
			if (data[0] == t) {
				if (!eraced[0])return 0;
				else return -1;
			}
			if (!(data[0] < t))return -1;
			if (data[n - 1] < t)return -1;
			break;
		}
		int r = 0;
		for (int i = 30; i >= 0; i--) {
			int c = r + (1 << i);
			if (c >= n)continue;
			if (data[c] < t)r = c;
		}
		r++;
		if (data[r] == t && !eraced[r]) {
			return r;
		}
		switch (mode) {
		case 'p':
			return Prev(r);
		case 'n':
			if (eraced[r])return Next(r);
			else return r;
		default:
			return -1;
		}
	}

};


int getint() {
	int r;
	scanf("%d", &r);
	return r;
}

int main() {
	int N = getint();
	int Q = getint();
	STX *stx = new STX[N];
	for (int i = 0; i < N; i++) {
		stx[i].s = getint();
		stx[i].t = getint();
		stx[i].x = getint();
	}
	D *ds = new D[Q];
	for (int i = 0; i < Q; i++) {
		ds[i].t = getint();
	}
	ErasableSortedArray<D> d(ds, Q);
	std::sort(stx, stx + N);
	for (int i = 0; i < N; i++) {
		int c = d.Search(stx[i].s - stx[i].x, 'n');
		for (int j = c; j < Q&&d[j] < stx[i].t - stx[i].x;) {
			int n = d.Next(j);
			d[j].s = stx[i].x;
			d.Erace(j);
			j = n;
		}
	}
	for (int i = 0; i < Q; i++) {
		printf("%d\n", ds[i].s);
	}
	return 0;
}

Measured memory_bytes: 9088