#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

template<typename T, typename U>
class SegmentTree{
    int n;
    int height;
    vector<T> node;
    vector<U> lazy;
    vector<int> len;

    using F = function<T(T, T)>;
    using G = function<T(T, U)>;
    using H = function<U(U, U)>;
    using S = function<U(U, int)>;

    F f;
    G g;
    H h;
    S s;
    T en;
    U el;

    void evaluate(int k){
        if(lazy[k] == el){
            return;
        }

        if(k < n){
            lazy[k << 1] = h(lazy[k << 1], lazy[k]);
            lazy[(k << 1) | 1] = h(lazy[(k << 1) | 1], lazy[k]);
        }

        node[k] = g(node[k], s(lazy[k], len[k]));
        lazy[k] = el;

        return;
    }

    void evaluate(int l, int r){
        for(int i = height ; 0 < i ; --i){
            evaluate(l >> i);
            evaluate(r >> i);
        }

        return;
    }

    void update(int k){
        evaluate(k << 1);
        evaluate((k << 1) | 1);
        node[k] = f(node[k << 1], node[(k << 1) | 1]);
        return;
    }

public:
    SegmentTree(int n_, F f_, G g_, H h_, S s_, T en_, U el_){
        init(n_, f_, g_, h_, s_, en_, el_);
    }

    SegmentTree(const vector<T>& dat, F f_, G g_, H h_, S s_, T en_, U el_){
        build(dat, f_, g_, h_, s_, en_, el_);
    }

    void init(int n_, F f_, G g_, H h_, S s_, T en_, U el_){
        n = 1;
        height = 0;
        while(n < n_){
            n <<= 1;
            ++height;
        }
        f = f_;
        g = g_;
        h = h_;
        s = s_;
        en = en_;
        el = el_;

        node.resize(n << 1);
        fill(node.begin(), node.end(), en);
        lazy.resize(n << 1);
        fill(lazy.begin(), lazy.end(), el);

        len.resize(n << 1);
        fill(len.begin(), len.end(), 0);

        for(int i = 0 ; i < n_ ; ++i){
            len[i + n] = 1;
        }

        for(int i = n - 1 ; 0 < i ; --i){
            len[i] = len[i << 1] + len[(i << 1) | 1];
        }

        return;
    }

    void build(const vector<T>& dat, F f_, G g_, H h_, S s_, T en_, U el_){
        int n_ = (int)dat.size();

        init(n_, f_, g_, h_, s_, en_, el_);

        for(int i = 0 ; i < n_ ; ++i){
            node[i + n] = dat[i];
        }

        for(int i = n - 1 ; 0 < i ; --i){
            node[i] = f(node[i << 1], node[(i << 1) | 1]);
        }

        return;
    }

    void update(int l, int r, U x){
        l += n;
        r += n - 1;

        evaluate(l, r);

        int tl = l;
        int tr = r;

        ++r;
        while(l < r){
            if(l & 1){
                lazy[l] = h(lazy[l], x);
                evaluate(l++);
            }
            l >>= 1;
            if(r & 1){
                lazy[--r] = h(lazy[r], x);
                evaluate(r);
            }
            r >>= 1;
        }

        while(tl >>= 1, tr >>= 1, tl){
            if(lazy[tl] == el){
                update(tl);
            }
            if(lazy[tr] == el){
                update(tr);
            }
        }

        return;
    }

    T get(int l, int r){
        l += n;
        r += n - 1;

        evaluate(l, r);

        T res = en;
        ++r;
        while(l < r){
            if(l & 1){
                evaluate(l);
                res = f(res, node[l++]);
            }
            l >>= 1;
            if(r & 1){
                evaluate(--r);
                res = f(res, node[r]);
            }
            r >>= 1;
        }

        return res;
    }
};

#include<iostream>
#include<unordered_map>

template<typename T>
T gcd(T x, T y){
    T r;
    while(y){
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}

template<typename T>
int compress(vector<T> v, unordered_map<T, int> &zip, vector<T> &unzip){
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    unzip.resize(v.size());
    for(int i = 0, i_len = (int)v.size() ; i < i_len ; ++i){
        zip[v[i]] = i;
        unzip[i] = v[i];
    }
    return (int)v.size();
}

using lint = long long;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

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

    vector<int> ti;

    vector< pair<int, pair<int, int> > > v;
    for(int i = 0 ; i < n ; ++i){
        int s, t, x;
        cin >> s >> t >> x;
        ti.emplace_back(s - x);
        ti.emplace_back(t - x);
        v.push_back({x, {s - x, t - x}});
    }

    vector<int> d(q);
    for(int i = 0 ; i < q ; ++i){
        cin >> d[i];
        ti.emplace_back(d[i]);
    }

    unordered_map<int, int> zip;
    vector<int> unzip;

    int m = compress(ti, zip, unzip);

    SegmentTree<int, int> seg(m, [](int l, int r){ return min(l, r); }, [](int l, int r){ return min(l, r);},
    [](int l, int r){ return min(l, r); }, [](int l, int r){ return l; }, 1 << 30, 1 << 30);

    for(int i = 0 ; i < n ; ++i){
        seg.update(zip[v[i].second.first], zip[v[i].second.second], v[i].first);
    }

    for(int i = 0 ; i < q ; ++i){
        int ans = seg.get(zip[d[i]], zip[d[i]] + 1);
        if(ans < (1 << 30)){
            cout << ans << "\n";
        }else{
            cout << -1 << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 62068