#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const int INF = 1e9;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
typedef struct{
    ll S;
    ll T;
    ll X;
} P;

bool comp(P p1, P p2){
    return p1.X > p2.X;
}
// const int INF = INT_MAX;
struct LazySegmentTree {
private:
    int n;
    vector<int> node, lazy;
    vector<bool> lazyFlag;
 
public:
    LazySegmentTree(vector<int> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, INF);
        lazyFlag.resize(2*n-1, false);
 
        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
 
    void lazyEvaluate(int k, int l, int r) {
        if(lazyFlag[k]) {
            node[k] = lazy[k];
            if(r - l > 1) {
                lazy[k*2+1] = lazy[k*2+2] = lazy[k];
                lazyFlag[k*2+1] = lazyFlag[k*2+2] = true;
            }
            lazyFlag[k] = false;
        }
    }
 
    void update(int a, int b, int x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazyEvaluate(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] = x;
            lazyFlag[k] = true;
            lazyEvaluate(k, l, r);
        }
        else {
            update(a, b, x, 2*k+1, l, (l+r)/2);
            update(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = min(node[2*k+1], node[2*k+2]);
        }
    }
 
    int find(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazyEvaluate(k, l, r);
        if(b <= l || r <= a) return INF;
        if(a <= l && r <= b) return node[k];
        int vl = find(a, b, 2*k+1, l, (l+r)/2);
        int vr = find(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,Q;
    cin >> N >> Q;
    ll S[200010], T[200010], X[200010];
    ll D[200010];
    rep(i,0,N){
        cin >> S[i] >> T[i] >> X[i];
        T[i]--;
    }
    rep(i,0,Q){
        cin >> D[i];
    }
    ll pos[200010];
    memset(pos, -1, sizeof(pos));
    vector<P> lp;
    rep(i,0,N){
        P tmp = {S[i], T[i], X[i]};
        lp.push_back(tmp);
    }
    sort(lp.begin(), lp.end(), comp);
    // LazySegmentTree seg( vector<int>(Q, INF) );
    vector<lpair> ans;
    rep(i,0,N){
        ll s = lp[i].S;
        ll t = lp[i].T;
        ll x = lp[i].X;
        if(s < x) s = x;
        if(t < x) t = x;
        ll ss = max(0LL, s - x);
        ll tt = max(0LL, t - x);
        ll p1 = lower_bound(D, D+Q, ss) - D;
        ll p2 = upper_bound(D, D+Q, tt) - D;
        ans.push_back(make_pair(p1,p2));
        // print2(p1,p2);

        // seg.update(p1,p2,x);
    }
    reverse(ans.begin(), ans.end());
    set<ll> st;
    rep(i,0,Q) st.insert(i);
    // 0 1 2 3 4 5
    rep(i,0,N){
        // print2(ans[i].first, ans[i].second);
        auto it1 = st.lower_bound(ans[i].first);
        auto it2 = st.upper_bound(ans[i].second-1);
        // it2--;
        while(it1 != it2){
            auto itt = it1;
            ll v = *itt;
            pos[v] = lp[N-1-i].X;
            itt++;
            st.erase(it1);
            it1 = itt;
        }
        // print("---");

    }
    rep(i,0,Q) print(pos[i]);
    // seg.update(0,N,1);


    // rep(i,0,Q){
    //     ll v = seg.find(i,i+1);
    //     if(v == INF){
    //         print(-1);
    //     }else{
    //         print(v);
    //     }
    // }

    
}

Measured memory_bytes: 28012