#pragma GCC optimize("O3", "unroll-loops")

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <sstream>
#include <deque>
#include <queue>
#include <random>
#include <complex>

using namespace std;

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FIXED cout << fixed << setprecision(12);
#define RANDOM srand(94385)
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define graph vector<vector<int>>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define f first
#define s second
#define hashmap unordered_map
#define hashset unordered_set
#define eps 1e-9
#define mod 1000000007
#define inf 3000000000000000007ll
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define shuffle(a) \
    for (int i = 0; i < sz(a); ++i) \
        swap(a[i], a[rand() % sz(a)])

template<class T, class U> inline void checkmin(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void checkmax(T &x, U y) { if (y > x) x = y; }
template<class T, class U> inline bool ifmax(T &x, U y) { if (y > x) return x = y, true; return false; }
template<class T, class U> inline bool ifmin(T &x, U y) { if (y < x) return x = y, true; return false; }
template<class T> inline void sort(T &a) { sort(all(a)); }
template<class T> inline void rsort(T &a) { sort(rall(a)); }
template<class T> inline void reverse(T &a) { reverse(all(a)); }
template<class T, class U> inline istream& operator>>(istream& str, pair<T, U> &p) { return str >> p.f >> p.s; }
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

struct node {
    int mn = mod;
    int l = 0;
    node() {}
    node(int k) { mn = k; }
    node operator=(const node &n) { mn = n.mn; return *this; }
    void apply(int x) { checkmin(mn, x); }
};

node merge(node a, node b) {
    return node(min(a.mn, b.mn));
}

struct Tree {
    static const int n = 1 << 30;
    node t[30000000];
    int ptr = 2;
    void add(int &v) {
        if (v == 0) v = ptr, ptr += 2;
    }
    void push(int v, int x) {
        t[v].apply(x);
        t[v + 1].apply(x);
    }
    void upd(int l, int r, int x, int v = 1, int vl = -n, int vr = n) {
        if (vl >= r || vr <= l) return;
        if (vl >= l && vr <= r) return t[v].apply(x);
        int vm = vl + vr >> 1;
        add(t[v].l);
        push(t[v].l, t[v].mn);
        upd(l, r, x, t[v].l, vl, vm);
        upd(l, r, x, t[v].l + 1, vm, vr);
    }
    int get(int x, int v = 1, int vl = -n, int vr = n) {
        if (vl > x || vr <= x) return mod;
        if (t[v].l == 0) return t[v].mn;
        int vm = vl + vr >> 1;
        push(t[v].l, t[v].mn);
        return min(get(x, t[v].l, vl, vm), get(x, t[v].l + 1, vm, vr));
    }
} tree;

signed main() {
    FAST; FIXED; RANDOM;
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < n; ++i) {
        int s, t, x;
        cin >> s >> t >> x;
        tree.upd(s - x, t - x, x);
    }
    while (q--) {
        int d;
        cin >> d;
        int ans = tree.get(d);
        if (ans == mod) cout << -1;
        else cout << ans;
        cout << '\n';
    }
    return 0;
}   

Measured memory_bytes: 236288