#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;

// 0-index
template <class T0, class T1>
class LazySegmentTree{
private:
    void eval(int k, int len){
        node[k] = g(node[k], p(lazy[k], len));

        if(k < n-1){
            lazy[2 * k + 1] = f1(lazy[2 * k + 1], lazy[k]);
            lazy[2 * k + 2] = f1(lazy[2 * k + 2], lazy[k]);
        }
        lazy[k] = u1;
    }

    void update(int a, int b, T1 x, int k, int l, int r){
        eval(k, r - l);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b){
            lazy[k] = f1(lazy[k], x);
            eval(k, r - l);
        }
        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] = f0(node[2 * k + 1], node[2 * k + 2]);
        }
    }

    T0 query(int a, int b, int k, int l, int r){
        if (r <= a || b <= l){
            return u0;
        }
        eval(k, r - l);
        if (a <= l && r <= b){
            return node[k];
        }
        T0 vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        T0 vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return f0(vl, vr);
    }


public:
    int sz;  // 元の配列サイズ
    int n;
    vector<T0> node;
    vector<T1> lazy;
    using F0 = function<T0(T0, T0)>; F0 f0; T0 u0;
    using F1 = function<T1(T1, T1)>; F1 f1; T1 u1;
    using G = function<T0(T0, T1)>;  G g;
    using P = function<T1(T1, int)>; P p;

    LazySegmentTree(vector<T0> v, F0 f0, T0 u0, F1 f1, T1 u1, G g, P p):
            sz(v.size()), f0(f0), u0(u0), f1(f1), u1(u1), g(g), p(p){
        n = 1;
        while(n < sz) n *= 2;
        node.resize(2*n-1, u0);
        lazy.resize(2*n-1, u1);

        for(int i = 0; i < sz; i++){
            node[i+n-1] = v[i];
        }
        for(int i = n-2; i >= 0; i--){
            node[i] = f0(node[i*2+1], node[i*2+2]);
        }
    }

    void update(int a, int b, T1 x){
        update(a, b, x, 0, 0, n);
    }

    void update(int a, T1 x){
        update(a, a+1, x);
    }

    T0 query(int a, int b){
        return query(a, b, 0, 0, n);
    }

    T0 query(int a){
        return query(a, a+1);
    }
};


vector<int> t_vec;
vector<T> I;
map<int, int> mp;
vector<int> d(210000, 0);


signed main(){
    int n, q;
    cin >> n >> q;

    for(int i = 0; i < n; i++){
        int s, t, x;
        cin >> s >> t >> x;
        T ii(x, s, t);
        I.push_back(ii);
        t_vec.push_back(s - x);
        t_vec.push_back(t - x);
    }

    for(int i = 0; i < q; i++){
        cin >> d[i];
        t_vec.push_back(d[i]);
    }
    sort(t_vec.begin(), t_vec.end());
    sort(I.begin(), I.end());
    auto itr = unique(t_vec.begin(), t_vec.end());
    t_vec.erase(itr, t_vec.end());

    for(int i = 0; i < t_vec.size(); i++){
        mp[t_vec[i]] = i;
    }

    LazySegmentTree<int, int> seg(
            vector<int>(t_vec.size(), (int)1e9+10),
            [](int x, int y) { return min(x, y); }, (int)1e9+10,
            [](int x, int y) { return y == (int)1e9+10 ? x : y; }, (int)1e9+10,
            [](int x, int y) { return y == (int)1e9+10 ? x : y; },
            [](int x, int len) { return x; }
    );


    for(int i = n-1; i >= 0; i--){
        int st = mp[get<1>(I[i]) - get<0>(I[i])], en = mp[get<2>(I[i]) - get<0>(I[i])];
        seg.update(st, en, get<0>(I[i]));
    }

    for(int i = 0; i < q; i++){
        int index = mp[d[i]];
        int res = seg.query(index);
        if(res == (int)1e9 + 10){
            cout << -1 << endl;
        }
        else{
            cout << res << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 52896