#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

template <class T, class T2>
class LazySegTree {
    using F = function<T(T, T)>;
    using G = function<T(T, T2)>;
    using H = function<T2(T2, T2)>;
    using P = function<T2(T2, int)>;
    int n;
    vector<T> data;
    vector<T2> lazy;
    const F f;
    const G g;
    const H h;
    const P p;
    const T e;
    const T2 e2;

public:
    LazySegTree(const vector<T>& as, const F f, const G g, const H h, const P p, const T& e, const T2 e2) : f(f), g(g), h(h), p(p), e(e), e2(e2) {
        n = 1;
        while (n < as.size()) n <<= 1;
        data.assign(2 * n, e);
        lazy.assign(2 * n, e2);
        for (int i = 0; i < as.size(); i++) {
            data[n + i] = as[i];
        }
        for (int i = n - 1; i > 0; i--) {
            data[i] = f(data[2 * i], data[2 * i + 1]);
        }
    }

    void propagate(int k, int len) {
        if (lazy[k] != e2) {
            if (k < n) {
                lazy[2 * k] = h(lazy[2 * k], lazy[k]);
                lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
            }
            data[k] = g(data[k], p(lazy[k], len));
            lazy[k] = e2;
        }
    }

    T update(int a, int b, const T2& x, int k, int l, int r) {
        propagate(k, r - l);
        if (r <= a || b <= l) {
            return data[k];
        } else if (a <= l && r <= b) {
            lazy[k] = h(lazy[k], x);
            propagate(k, r - l);
            return data[k];
        } else {
            return data[k] = f(update(a, b, x, 2 * k, l, (l + r) >> 1), update(a, b, x, 2 * k + 1, (l + r) >> 1, r));
        }
    }

    T update(int a, int b, const T2& x) {
        return update(a, b, x, 1, 0, n);
    }

    T query(int a, int b, int k, int l, int r) {
        propagate(k, r - l);
        if (r <= a || b <= l) {
            return e;
        } else if (a <= l && r <= b) {
            return data[k];
        } else {
            return f(query(a, b, 2 * k, l, (l + r) >> 1), query(a, b, 2 * k + 1, (l + r) >> 1, r));
        }
    }

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

int main() {
    //    freopen("/Users/xuzijian/atcoder/abc128/input", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<tuple<int, int, int>> as;
    for (int i = 0; i < n; i++) {
        int s, t, x;
        cin >> s >> t >> x;
        as.emplace_back(x, s - x, t - x);
    }
    sort(as.begin(), as.end());
    map<int, int> mp, rev;
    for (int i = 0; i < n; i++) {
        int l = get<1>(as[i]), r = get<2>(as[i]);
        mp[l], mp[r];
    }
    int N = 0;
    for (auto &p : mp) {
        p.second = N;
        rev[N] = p.second;
        N++;
    }


    // RUQ, RSQ
    const i64 INF = 1e18;
    auto f = [](i64 a, i64 b) {return a + b;};
    auto g = [](i64 a, i64 b) {return b == INF ? a : b;};
    auto h = [](i64 a, i64 b) {return b == INF ? a : b;};
    auto p = [](i64 a, i64 b) {return a == INF ? INF : a * b;};
    LazySegTree<i64, i64> seg(vi(N), f, g, h, p, 0, INF);

    for (int i = n - 1; i >= 0; i--) {
        int x = get<0>(as[i]), l = get<1>(as[i]), r = get<2>(as[i]);
        int L = mp[l], R = mp[r];
        seg.update(L, R, x);
    }

    while (q--) {
        int d;
        cin >> d;
        auto it = mp.lower_bound(d + 1);
        if (it == mp.begin()) {
            cout << -1 << '\n';
            continue;
        }
        it--;
        int x = it->second;
        int r = seg.query(x, x + 1);
        cout << (r == 0 ? -1 : r) << '\n';
    }
}


Measured memory_bytes: 60016