#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

typedef pair<int, int> P;

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<tuple<int, int, int>> a(N);
    rep(i, N) {
        int s, t, x;
        cin >> s >> t >> x;
        a[i] = make_tuple(x, s - x, t - x);
    }
    sort(a.begin(), a.end());

    set<P> s;
    rep(i, Q) {
        int q;
        cin >> q;
        s.insert({q, i});
    }

    vector<int> ans(Q, -1);
    rep(i, N) {
        int x, l, r;
        tie(x, l, r) = a[i];

        auto it = s.lower_bound(P(l, -1));
        while (it != s.end()) {
            if (it->first >= r) break;
            ans[it->second] = x;
            s.erase(it++);
        }
    }

    rep(i, Q) {
        cout << ans[i] << endl;
    }
}