#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>

using namespace std;

// Segment Tree
template<class Monoid, class Action> struct SegTree {
    using FuncMonoid = function< Monoid(Monoid, Monoid) >;
    using FuncAction = function< void(Monoid&, Action) >;
    using FuncLazy = function< void(Action&, Action) >;
    FuncMonoid FM;
    FuncAction FA;
    FuncLazy FL;
    Monoid UNITY_MONOID;
    Action UNITY_LAZY;
    int SIZE, HEIGHT;
    vector<Monoid> dat;
    vector<Action> lazy;
    
    SegTree() { }
    SegTree(int n, const FuncMonoid fm, const FuncAction fa, const FuncLazy fl,
            const Monoid &unity_monoid, const Action &unity_lazy)
    : FM(fm), FA(fa), FL(fl), UNITY_MONOID(unity_monoid), UNITY_LAZY(unity_lazy) {
        SIZE = 1; HEIGHT = 0;
        while (SIZE < n) SIZE <<= 1, ++HEIGHT;
        dat.assign(SIZE * 2, UNITY_MONOID);
        lazy.assign(SIZE * 2, UNITY_LAZY);
    }
    void init(int n, const FuncMonoid fm, const FuncAction fa, const FuncLazy fl,
              const Monoid &unity_monoid, const Action &unity_lazy) {
        FM = fm; FA = fa; FL = fl;
        UNITY_MONOID = unity_monoid; UNITY_LAZY = unity_lazy;
        SIZE = 1; HEIGHT = 0;
        while (SIZE < n) SIZE <<= 1, ++HEIGHT;
        dat.assign(SIZE * 2, UNITY_MONOID);
        lazy.assign(SIZE * 2, UNITY_LAZY);
    }
    
    /* set, a is 0-indexed */
    void set(int a, const Monoid &v) { dat[a + SIZE] = v; }
    void build() {
        for (int k = SIZE - 1; k > 0; --k)
            dat[k] = FM(dat[k*2], dat[k*2+1]);
    }
    
    /* update [a, b) */
    inline void evaluate(int k) {
        if (lazy[k] == UNITY_LAZY) return;
        if (k < SIZE) FL(lazy[k*2], lazy[k]), FL(lazy[k*2+1], lazy[k]);
        FA(dat[k], lazy[k]);
        lazy[k] = UNITY_LAZY;
    }
    inline void update(int a, int b, const Action &v, int k, int l, int r) {
        evaluate(k);
        if (a <= l && r <= b)  FL(lazy[k], v), evaluate(k);
        else if (a < r && l < b) {
            update(a, b, v, k*2, l, (l+r)>>1), update(a, b, v, k*2+1, (l+r)>>1, r);
            dat[k] = FM(dat[k*2], dat[k*2+1]);
        }
    }
    inline void update(int a, int b, const Action &v) { update(a, b, v, 1, 0, SIZE); }
    
    /* get [a, b) */
    inline Monoid get(int a, int b, int k, int l, int r) {
        evaluate(k);
        if (a <= l && r <= b)
            return dat[k];
        else if (a < r && l < b)
            return FM(get(a, b, k*2, l, (l+r)>>1), get(a, b, k*2+1, (l+r)>>1, r));
        else
            return UNITY_MONOID;
    }
    inline Monoid get(int a, int b) { return get(a, b, 1, 0, SIZE); }
    inline Monoid operator [] (int a) { return get(a, a+1); }
    
    /* debug */
    void print() {
        for (int i = 0; i < SIZE; ++i) { cout << (*this)[i]; if (i != SIZE) cout << ","; }
        cout << endl;
    }
};
typedef pair<int, int> P;
typedef pair<int, P> PP;
int main() {
    int N, M;
    cin >> N >> M;
    auto fm = [](long long a, long long b) { return max(a, b); };
    auto fa = [](long long &a, long long d) { a = max(a, d); };
    auto fl = [](long long &d, long long e) { d = max(d, e); };
    SegTree<long long, long long> seg(M+1, fm, fa, fl, 0, 0);
    PP p[200010];
    for(int i = 0; i < N; i++) {
        cin >> p[i].second.first >> p[i].second.second >> p[i].first;
        p[i].second.first -= p[i].first;
        p[i].second.second -= p[i].first + 1;
    }
    //sort(p, p + N, greater<PP>());

    int D[200010];
    for(int i = 0; i < M; i++) {
        cin >> D[i];
    }
    seg.update(0, M + 1, -1);
    for(int i = 0; i < N; i++) {
        int ok = M;
        int ng = -1;
        int L = p[i].second.first;
        int R = p[i].second.second;
        while(abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;
            if(L <= D[mid]) ok = mid;
            else ng = mid;
        }
        int ok2 = -1;
        int ng2 = M;
        while(abs(ok2 - ng2) > 1) {
            int mid = (ok2 + ng2) / 2;
            if(D[mid] <= R) ok2 = mid;
            else ng2 = mid;
        }
        if(ok <= ok2) {
            
            seg.update(ok, ok2 + 1, 2000000000-p[i].first);
        }
    }
    for (int i = 0; i < M; ++i) {
        int c = 2000000000-seg.get(i, i+1);
        if(c == 2000000000) cout << -1 << endl;
        else  cout << c << endl;
    }


}

Measured memory_bytes: 14544