#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    const ll push = 0;
    const ll pop = 1;
    const ll get = 2;
    struct Data{
        ll key, qid, val;
        Data(): key(0), qid(0), val(0){}
        Data(ll k, ll q, ll v): key(k), qid(q), val(v){}
        bool operator<(const Data& e) const{
            if(key == e.key){
                if(qid == e.qid) return val < e.val;
                return qid < e.qid;
            }
            return key < e.key;
        }
    };

    int N, Q;
    cin >> N >> Q;
    vector<ll> S(N), T(N), X(N), D(Q), ans(Q);
    for(int i=0; i<N; i++) cin >> S[i] >> T[i] >> X[i];
    for(auto& x: D) cin >> x;

    multimap<ll, Pll> mp;
    vector<Data> ds(2*N+Q);
    for(int i=0; i<N; i++){
        ds[2*i] = Data(S[i]-X[i], push, X[i]);
        ds[2*i+1] = Data(T[i]-X[i], pop, X[i]);
    }
    for(int i=0; i<Q; i++) ds[2*N+i] = Data(D[i], get, i);
    sort(ds.begin(), ds.end());

    multiset<ll> Xs;
    for(auto& d: ds){
        ll qid = d.qid;
        ll val = d.val;
        // cout << d.key << " " << qid << " " << val << "\n";
        if(qid == push) Xs.insert(val);
        else if(qid == pop){
            auto itr = Xs.find(val);
            Xs.erase(itr);
        }else{
            if(Xs.empty()) ans[val] = -1;
            else ans[val] = *Xs.begin();
        }
    }

    for(auto& x: ans) cout << x << "\n";
}
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

using Weight=long long;
static const Weight INF=1LL<<57;

struct Edge {
    size_t src, dst;
    Weight weight;
    Edge() {}
    Edge(size_t src, size_t dst, Weight weight=1):
        src(src), dst(dst), weight(weight)
    {}
};

bool operator<(const Edge &e, const Edge &f) {
    if (e.weight != f.weight) {
        return e.weight > f.weight;
    } else {
        return e.src!=f.src? e.src<f.src : e.dst<f.dst;
    }
}

using Edges=vector<Edge>;
using Vertex=vector<Edge>;
using Graph=vector<Vertex>;

void join(Graph &g, size_t s, size_t d, Weight w=1) {
    // non-directed
    g[s].push_back(Edge(s, d, w));
    g[d].push_back(Edge(d, s, w));
}

void connect(Graph &g, size_t s, size_t d, Weight w=1) {
    // directed
    g[s].push_back(Edge(s, d, w));
}

void visit(
    const Graph &g, size_t v, size_t u, set<size_t> &artpoint,
    vector<size_t> &num, vector<size_t> &low, int &time
) {
    low[v] = num[v] = ++time;
    for (const Edge &e: g[v]) {
        size_t w=e.dst;
        if (!num[w]) {
            visit(g, w, v, artpoint, num, low, time);
            low[v] = min(low[v], low[w]);

            if (num[v]==1? num[w]!=2 : low[w]>=num[v])
                artpoint.insert(v);

        } else {
            low[v] = min(low[v], num[w]);
        }
    }
}

set<size_t> get_artpoint(const Graph &g) {
    const size_t V=g.size();

    vector<size_t> low(V), num(V);
    set<size_t> artpoint;
    for (size_t u=0; u<V; ++u) if (!num[u]) {
        int time=0;
        visit(g, u, -1, artpoint, num, low, time);
    }

    return artpoint;
}

int main() {
    size_t V, E;
    scanf("%zu %zu", &V, &E);

    Graph g(V);
    for (size_t i=0; i<E; ++i) {
        size_t s, t;
        scanf("%zu %zu", &s, &t);

        join(g, s, t);
    }

    set<size_t> artpoint=get_artpoint(g);

    for (size_t v: artpoint)
        printf("%zu\n", v);

    return 0;
}