#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 0
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

#define SUBMIT

// 1 次元座標圧縮
// 値のバリエーションが 10^7 以下程度なら
// 圧縮して保持することで TLE を防げる
class CoordComp {
    public:
        // 値を追加します O(1)
        // 重複した値は意味がないので、削除します
        void Add(ll v) { m_V.push_back(v); }

        // 値の追加を終え座標を圧縮します O(N log N)
        void Build() {
            sort(m_V.begin(), m_V.end());
            m_V.erase(unique(m_V.begin(), m_V.end()), m_V.end());
            // 圧縮した各値のインデックス * 2 + 1 を圧縮後の値とする
            m_Decomp.assign(m_V.size() * 2 + 1, 0);
            for(int i = 0; i < m_V.size(); ++i) {
                m_Comp[m_V[i]] = i * 2 + 1;
                m_Decomp[i * 2 + 1] = m_V[i];
            }
            // m_Decompress の埋まっていない部分を作成
            assert(m_Decomp.size() >= 3);
            m_Decomp[0] = m_Decomp[1] - 1;
            m_Decomp[m_Decomp.size()-1] = m_Decomp[m_Decomp.size()-2] + 1;
            for(int i = 1; i < m_V.size(); ++i) {
                m_Decomp[i*2] = (m_Decomp[i*2-1] + m_Decomp[i*2+1]) / 2;
            }
        }

        // n の圧縮後の世界での値を返します O(log N)
        ll GetComp(ll n) {
            // あるならそれを返す
            if(m_Comp.count(n) > 0) { return m_Comp[n]; }
            // 最小値より小さい／最大値より大きい処理
            if(n < m_V[0]) { return 0; }
            if(m_V[m_V.size()-1] < n) { return m_V.size() * 2; }
            // そうでないならある 2 点の間
            auto it = upper_bound(m_Decomp.begin(), m_Decomp.end(), n);
            return static_cast<ll>(it - m_Decomp.begin()) - 1;
        }

        // n の圧縮前の世界での値を返します O(1)
        // 一意に特定できない場合、以下の値を返します
        // A) 追加済みの 2 点の間に含まれる値の場合　…　その 2 点の中間の値を返す
        // B) 追加済みのどの点より大きいまたは小さい　…　追加済みの最小点 - 1／最大点 + 1 を返す
        ll GetDecomp(ll n) {
            assert(0 <= n && n < m_Decomp.size());
            return m_Decomp[n];
        }
        // 圧縮前の世界に n があるなら true を返します O(log N)
        bool IsFind(ll n) { return binary_search(m_V.begin(), m_V.end(), n); }
        // 座標圧縮後の空間のサイズです O(1)
        size_t GetSize() { return m_Decomp.size(); }
    private:
        vector<ll> m_V;         // 管理する一次元座標一覧
        map<ll, ll> m_Comp;     // 値を圧縮後の値に
        vector<ll> m_Decomp;    // 圧縮された値を元の値に
};

// 座標圧縮セグメント木
// 座標圧縮する関係上 Build() 後の値更新ができないが、
// 扱える範囲が拡大した。 10^9 程度の範囲なら問題なく扱える
template<typename SType>
class CompSegmentTree {
    public:
        using Func = function< SType(SType, SType) >;
    private:
        class SegmentTreeImpl {
            public:
                SegmentTreeImpl() {}
                SegmentTreeImpl(ll n, const Func f, const SType &e) { Init(n, f, e); }
                void Init(ll n, const Func f, const SType &e) {
                    m_F = f; m_E = e;
                    m_Size = 1;
                    while(m_Size < n) { m_Size <<= 1; }
                    m_Seg.assign(2 * m_Size, m_E);
                }
                void Update(int k, const SType &x) {
                    k += m_Size;
                    m_Seg[k] = x;
                    while(k >>= 1) {
                        m_Seg[k] = m_F(m_Seg[2 * k + 0], m_Seg[2 * k + 1]);
                    }
                }
                void Build() {
                    for(ll k = m_Size - 1; k > 0; k--) {
                        m_Seg[k] = m_F(m_Seg[2 * k + 0], m_Seg[2 * k + 1]);
                    }
                }
                SType Query(ll a, ll b) {
                    assert(a < b && 0 <= a && b < m_Size);
                    SType l = m_E, r = m_E;
                    for(a += m_Size, b += m_Size; a < b; a >>= 1, b >>= 1) {
                        if(a & 1) l = m_F(l, m_Seg[a++]);
                        if(b & 1) r = m_F(m_Seg[--b], r);
                    }
                    return m_F(l, r);
                }
                SType operator[](const ll &k) const
                {
                    return m_Seg[k + m_Size];
                }
            private:
                Func m_F;
                SType m_E;
                int m_Size;
                vector< SType > m_Seg;
        };

        class CoordCompImpl {
            public:
                void Add(ll v) { m_V.push_back(v); }
                void Build() {
                    sort(m_V.begin(), m_V.end());
                    m_V.erase(unique(m_V.begin(), m_V.end()), m_V.end());
                    m_Decomp.assign(m_V.size() * 2 + 1, 0);
                    for(int i = 0; i < m_V.size(); ++i) {
                        m_Comp[m_V[i]] = i * 2 + 1;
                        m_Decomp[i * 2 + 1] = m_V[i];
                    }
                    assert(m_Decomp.size() >= 3);
                    m_Decomp[0] = m_Decomp[1] - 1;
                    m_Decomp[m_Decomp.size()-1] = m_Decomp[m_Decomp.size()-2] + 1;
                    for(int i = 1; i < m_V.size(); ++i) {
                        m_Decomp[i*2] = (m_Decomp[i*2-1] + m_Decomp[i*2+1]) / 2;
                    }
                }
                ll GetComp(ll n) {
                    if(m_Comp.count(n) > 0) { return m_Comp[n]; }
                    if(n < m_V[0]) { return 0; }
                    if(m_V[m_V.size()-1] < n) { return m_V.size() * 2; }
                    auto it = upper_bound(m_Decomp.begin(), m_Decomp.end(), n);
                    return static_cast<ll>(it - m_Decomp.begin()) - 1;
                }
                size_t GetSize() { return m_Decomp.size(); }
            private:
                vector<ll> m_V;
                map<ll, ll> m_Comp;
                vector<ll> m_Decomp;
        };

    public:

        CompSegmentTree(const Func f, const SType &e) : m_F(f), m_E(e) {}

        // i を n で更新します O(log N)
        void Update(ll i, ll n) {
            if(m_PosVal.count(i) > 0) {
                m_PosVal[i] = m_F(m_PosVal[i], n);
            }
            else { m_PosVal[i] = n; }
            m_Cc.Add(i);
        }
        // セグ木を構築します O(N log N)
        // f: セグ木で判定する関数
        // e: 単位元
        void Build() {
            m_Cc.Build();   // 座標圧縮
            m_SegTree.Init(m_Cc.GetSize(), m_F, m_E);
            for(auto& pv : m_PosVal) {
                ll ind = m_Cc.GetComp(pv.first);    // 座標圧縮後の位置
                ll val = pv.second;                 // 位置に設定された値
                m_SegTree.Update(ind, val);
            }
            m_SegTree.Build();  // セグ木構築
        }

        // 区間 [a, b) に Func f を行った結果を返す O(log log N)
        SType Query(ll a, ll b) {
            ll comp_a = m_Cc.GetComp(a);
            ll comp_b = m_Cc.GetComp(b);
            if(a < b && comp_a == comp_b) { comp_b++; }
            return m_SegTree.Query(comp_a, comp_b);
        }

    private:
        Func m_F;                   // モノイド
        SType m_E;                  // 単位元
        map<ll, ll> m_PosVal;       // i にセットされた値
        SegmentTreeImpl m_SegTree;
        CoordCompImpl m_Cc;
};

class CompLazySegmentTree {
    private:
        class LazySegmentTreeImpl {
            private:
                enum Status { None = 0, Update_Min = 1, Update_Reset = 2 };
            public:
                LazySegmentTreeImpl() : m_E(LLINF) {}
                LazySegmentTreeImpl(ll n) : m_E(LLINF) { Init(n); }
                void Init(ll n) {
                    m_Size = 1;
                    while(m_Size < n) { m_Size <<= 1; }
                    m_Seg.assign(2 * m_Size, m_E);
                    m_Lazy.assign(2 * m_Size, m_E);
                    m_LazyFlag.assign(2 * m_Size, None);
                }
                void Set(ll k, ll x) {
                    assert(0 <= k && k < m_Size);
                    m_Seg[k + m_Size] = x;
                }
                void Build() {
                    for(int k = m_Size - 1; k > 0; k--) {
                        m_Seg[k] = min(m_Seg[2 * k + 0] , m_Seg[2 * k + 1]);
                    }
                }
                void Update(ll a, ll b, ll x) {
                    assert(0 <= a && a < b && b < m_Size);
                    MinImpl(a, b, x, 1, 0, m_Size);
                }
                void Reset(ll a, ll b, ll x) {
                    assert(0 <= a && a < b && b < m_Size);
                    ResetImpl(a, b, x, 1, 0, m_Size);
                }
                ll Query(ll a, ll b) {
                    assert(0 <= a && a < b && b < m_Size);
                    return QueryImpl(a, b, 1, 0, m_Size);
                }

            private:
                void Propagate(ll k, ll length) {
                    if(m_LazyFlag[k] == Update_Min) {
                        if(k < m_Size) {
                            if(m_LazyFlag[2 * k + 0] == Update_Reset) { Propagate(2 * k + 0, length / 2); }
                            if(m_LazyFlag[2 * k + 1] == Update_Reset) { Propagate(2 * k + 1, length / 2); }
                            m_Lazy[2 * k + 0] = min(m_Lazy[2 * k + 0], m_Lazy[k]);
                            m_Lazy[2 * k + 1] = min(m_Lazy[2 * k + 1], m_Lazy[k]);
                            m_LazyFlag[2 * k + 0] = m_LazyFlag[2 * k + 1] = Update_Min;
                        }
                        m_Seg[k] = min(m_Seg[k], m_Lazy[k]);
                        m_Lazy[k] = m_E;
                        m_LazyFlag[k] = None;
                    }
                    else if(m_LazyFlag[k] == Update_Reset) {
                        if(k < m_Size) {
                            m_Lazy[2 * k + 0] = m_Lazy[2 * k + 1] = m_Lazy[k];
                            m_LazyFlag[2 * k + 0] = m_LazyFlag[2 * k + 1] = Update_Reset;
                        }
                        m_Seg[k] = m_Lazy[k];
                        m_Lazy[k] = m_E;
                        m_LazyFlag[k] = None;
                    }
                }
                void MinImpl(ll a, ll b, ll x, ll k, ll l, ll r) {
                    Propagate(k, r - l);
                    if(b <= l || r <= a) { return; }
                    if(a <= l && r <= b) {
                        m_Lazy[k] = x;
                        m_LazyFlag[k] = Update_Min;
                        Propagate(k, r - l);
                    }
                    else {
                        MinImpl(a, b, x, 2 * k + 0, l, (l + r) >> 1);
                        MinImpl(a, b, x, 2 * k + 1, (l + r) >> 1, r);
                        m_Seg[k] = min(m_Seg[2 * k + 0], m_Seg[2 * k + 1]);
                    }
                };
                void ResetImpl(ll a, ll b, ll x, ll k, ll l, ll r) {
                    Propagate(k, r - l);
                    if(b <= l || r <= a) { return; }
                    if(a <= l && r <= b) {
                        m_Lazy[k] = x;
                        m_LazyFlag[k] = Update_Reset;
                        Propagate(k, r - l);
                    }
                    else {
                        ResetImpl(a, b, x, 2 * k + 0, l, (l + r) >> 1);
                        ResetImpl(a, b, x, 2 * k + 1, (l + r) >> 1, r);
                        m_Seg[k] = min(m_Seg[2 * k + 0], m_Seg[2 * k + 1]);
                    }
                };
                ll QueryImpl(ll a, ll b, ll k, ll l, ll r) {
                    Propagate(k, r - l);
                    if(b <= l || r <= a) { return LLINF; }
                    if(a <= l && r <= b) { return m_Seg[k]; }
                    return min(QueryImpl(a, b, 2 * k + 0, l, (l + r) >> 1),
                            QueryImpl(a, b, 2 * k + 1, (l + r) >> 1, r));
                }

            private:
                const ll m_E;
                ll m_Size;
                vector<ll> m_Seg;
                vector<ll> m_Lazy;
                vector<ll> m_LazyFlag;
        };

        class CoordCompImpl {
            public:
                void Add(ll v) { m_V.push_back(v); }
                void Build() {
                    sort(m_V.begin(), m_V.end());
                    m_V.erase(unique(m_V.begin(), m_V.end()), m_V.end());
                    m_Decomp.assign(m_V.size() * 2 + 1, 0);
                    for(int i = 0; i < m_V.size(); ++i) {
                        m_Comp[m_V[i]] = i * 2 + 1;
                        m_Decomp[i * 2 + 1] = m_V[i];
                    }
                    assert(m_Decomp.size() >= 3);
                    m_Decomp[0] = m_Decomp[1] - 1;
                    m_Decomp[m_Decomp.size()-1] = m_Decomp[m_Decomp.size()-2] + 1;
                    for(int i = 1; i < m_V.size(); ++i) {
                        m_Decomp[i*2] = (m_Decomp[i*2-1] + m_Decomp[i*2+1]) / 2;
                    }
                }
                ll GetComp(ll n) {
                    if(m_Comp.count(n) > 0) { return m_Comp[n]; }
                    if(n < m_V[0]) { return 0; }
                    if(m_V[m_V.size()-1] < n) { return m_V.size() * 2; }
                    auto it = upper_bound(m_Decomp.begin(), m_Decomp.end(), n);
                    return static_cast<ll>(it - m_Decomp.begin()) - 1;
                }
                size_t GetSize() { return m_Decomp.size(); }
            private:
                vector<ll> m_V;
                map<ll, ll> m_Comp;
                vector<ll> m_Decomp;
        };

    public:

        // [l, r) を n で更新します O(log N)
        void Update(ll l, ll r, ll n) {
            if(l > r) { swap(l, r); }
            if(m_PosVal.count(make_pair(l, r)) > 0) {
                m_PosVal[make_pair(l, r)] = min(m_PosVal[make_pair(l, r)], n);
            }
            else {
                m_PosVal[make_pair(l, r)] = n;
            }
            m_Cc.Add(l);
            m_Cc.Add(r);
        }
        // セグ木を構築します O(N log N)
        void Build() {
            m_Cc.Build();
            m_SegTree.Init(m_Cc.GetSize());
            for(auto& pv : m_PosVal) {
                ll lb = m_Cc.GetComp(pv.first.first);
                ll rb = m_Cc.GetComp(pv.first.second);
                ll val = pv.second;                 // 位置に設定された値
                DBG("CAND Update[%lld, %lld) -> %lld\n", lb, rb, val);
                m_SegTree.Update(lb, rb, val);
            }
            m_SegTree.Build();  // セグ木構築
        }
        // 区間 [a, b) の最小値を取得します O(log log N)
        ll Query(ll a, ll b) {
            ll comp_a = m_Cc.GetComp(a);
            ll comp_b = m_Cc.GetComp(b);
            if(a < b && comp_a == comp_b) { comp_b++; }
            return m_SegTree.Query(comp_a, comp_b);
        }

    private:
        map< pair<ll, ll>, ll> m_PosVal;    // 範囲 [l, r) にセットされた値
        LazySegmentTreeImpl m_SegTree;
        CoordCompImpl m_Cc;
};

ll N, Q;
vector<ll> S, T, X, D;

vector<ll> solve_tle() {
    // 区間 min
    auto Rmq = [](int a, int b) -> int
    {
        return min(a, b);
    };

    CompSegmentTree<ll> cst(Rmq, LLINF);
    REP(i, N) {
        ll lb = S[i] - X[i];
        ll ub = T[i] - X[i];
        DBG("ANS: [%lld, %lld) %lld\n", lb, ub, X[i]);
        for(int j = lb; j < ub; ++j) {
            cst.Update(j, X[i]);
        }
    }
    cst.Build();

    vector<ll> ret;
    REP(i, Q) {
        ll val = cst.Query(D[i], D[i]+1);
        DBG("ANS Query: %lld %lld %lld\n", D[i], D[i]+1, val);
        ret.push_back(val == LLINF ? -1 : val);
    }
    return ret;
}

vector<ll> solve() {
    CompLazySegmentTree clst;
    REP(i, N) {
        ll lb = S[i] - X[i];
        ll ub = T[i] - X[i];
        DBG("CAND: [%lld, %lld) %lld\n", lb, ub, X[i]);
        clst.Update(lb, ub, X[i]);
    }
    clst.Build();

    vector<ll> ret;
    REP(i, Q) {
        ll val = clst.Query(D[i], D[i]+1);
        DBG("CAND Query: %lld %lld %lld\n", D[i], D[i]+1, val);
        ret.push_back(val == LLINF ? -1 : val);
    }
    return ret;
}

signed main()
{
#ifdef SUBMIT
    cin >> N >> Q;
    S.resize(N);
    T.resize(N);
    X.resize(N);
    D.resize(Q);
    REP(i, N) { cin >> S[i] >> T[i] >> X[i]; }
    REP(i, Q) { cin >> D[i]; }

    vector<ll> ans = solve();
    //vector<ll> ans = solve_tle();
    for(auto& a : ans) { printf("%lld\n", a); }
#else
    random_device r;
    mt19937 mt(r());
    uniform_int_distribution<> dist(-100, 100);

    N = 1;
    Q = 1;
    REP(loop, 1000) {
        // 問題の作成
        S.assign(N, 0);
        T.assign(N, 0);
        X.assign(N, 0);
        REP(i, N) {
            S[i] = dist(mt);
            T[i] = dist(mt);
            while(S[i] == T[i]) { S[i] = dist(mt); }
            if(S[i] > T[i]) { swap(S[i], T[i]); }
            X[i] = dist(mt);
        }
        D.assign(Q, 0);
        REP(i, Q) { D[i] = dist(mt); }

        vector<ll> cand = solve();
        vector<ll> ans = solve_tle();
        REP(i, cand.size()) {
            if(cand[i] != ans[i]) {
                printf("[FAIL]\n");
                printf("%lld %lld\n", N, Q);
                REP(j, N) {
                    printf("%lld %lld %lld\n", S[j], T[j], X[j]);
                }
                REP(j, Q) {
                    printf("%lld\n", D[j]);
                }
                printf("cand: ");
                REP(j, cand.size()) { printf("%lld%c", cand[j], (j == cand.size()-1) ? '\n' : ' '); }
                printf("ans: ");
                REP(j, ans.size()) { printf("%lld%c", ans[j], (j == ans.size()-1) ? '\n' : ' '); }
                return 0;
            }
        }
    }

#endif
    return 0;
}


Measured memory_bytes: 106988