#include <bits/stdc++.h>
	
using namespace std;
inline void FAST_IO(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}

template<class F, class S> ostream& operator<<(ostream& os, pair<F, S> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template<class T, class S> ostream& operator<<(ostream& os, map<T, S> &v) {
	os << "{";
	for(auto &i : v) cout << "{" << i.first << "," << i.second << "}";
	os << "}";
	return os;
}

template<class T> ostream& operator<<(ostream& os, set<T> &v) {
	os << "{";
	for(auto &i : v) cout << i << ",";
	os << "}";
	return os;
}
 
template<class T> ostream& operator<<(ostream& os, vector<T> &v) {
	os << "[";
	if(v.size()) os << v[0];
	for(int i = 1; i < v.size(); ++i) os << "," << v[i];
	os << "]";
	return os;
}

/*----------------------------------------------------------------------------*/

class  SegTree{
    vector<int> st;
    vector<int> lazy;
    vector<bool> has;
    int size;

    int el_neutro = 0;

    int f(int a, int b){
        return max(a,b);
    }

     void propagate(int sti, int stl, int str){
        if(has[sti]){
            st[sti] = lazy[sti];
            if(stl != str){
                lazy[sti*2 + 1] = lazy[sti];
                lazy[sti*2 + 2] = lazy[sti];

                has[sti*2 + 1] = true;
                has[sti*2 + 2] = true;
            }
            has[sti] = false;
        }
    }

    int query(int sti, int stl, int str, int l, int r){
        propagate(sti, stl, str);

        if(str < l || r < stl)
            return el_neutro;

        if(stl >= l and str <= r)
            return st[sti];

        int mid = (str+stl)/2;

        return f(query(sti*2+1,stl,mid,l,r),query(sti*2+2,mid+1,str,l,r));
    }

    void update_range(int sti, int stl, int str, int l,int r, int amm){
		propagate(sti, stl, str);
		
		if(stl >= l and str <= r){
            lazy[sti] = amm;
            has[sti] = true;
            propagate(sti, stl, str);
            return;
        }

        if(stl > r  or str < l)
            return;
        
		int mid = (stl + str)/2;
        
		update_range(sti*2+1,stl,mid,l,r,amm);
        update_range(sti*2+2,mid+1,str,l,r,amm);
        
		st[sti] = f(st[sti*2+1],st[sti*2+2]);
    }

    public:
        SegTree(int n):  st(4*n,0), lazy(4*n,0),has(4*n,false),size(n){}
		
        int query(int l, int  r){
			return query(0,0,size-1,l,r);
		}
        
		void update_range(int l, int r, int amm){
			update_range(0,0,size-1,l,r,amm);
		}
};

int main (){
	// FAST_IO();

	int n,q;
	cin >> n >> q;

	map<int, vector<pair<int,int>>> a;
	for(int i = 0; i < n; ++i) {
		int s,t,x;
		scanf("%d %d %d", &s, &t, &x);
		a[-x].push_back({s,t});
	}

	vector<pair<int, int>> person(q);
	vector<int> d(q);
	SegTree st(q);

	for (int i = 0; i < q; ++i) {
		scanf("%d", &person[i].first);
		person[i].second = i;
		st.update_range(i,i,-1);
	}

	sort(person.begin(), person.end());
	for (int i = 0; i < q; ++i) d[i] = person[i].first;

	for (auto &[x, v] : a) {
		for (auto &[s,t] : v) {
			int lo = max(-x, s);
			int hi = max(-x, t-1);

			if ((-x <= t-1) && lo <= hi) {
				lo += x;
				hi += x;
				auto first = lower_bound(d.begin(), d.end(), lo) - d.begin();
				auto last = upper_bound(d.begin(), d.end(), hi) - d.begin();
				int amt = last - first;

				if (first != q && d[first] <= hi && amt) {
					st.update_range(first, first + amt - 1, -x);
				}
			}
		}
	}

	map<int, int> resp;
	for (int i = 0; i < q; ++i) {
		int v = st.query(i,i);
		resp[person[i].second] = v ? v : -1;
	}

	for (auto [x,y] : resp) printf("%d\n", y);

	return 0;
}


Measured memory_bytes: 43164