#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll N, q; cin >> N >> q;
    vector<tuple<ll, ll, ll>> cst(0);
    rep(i, 0, N){
        ll a, b, c; cin >> a >> b >> c;
        cst.emplace_back(c, a-c, b-c);
    }
    sort(cst.begin(),cst.end());
    vvll res(0, vll(2));
    set<ll> t;
    t.insert(INF);
    vll lis;
    rep(i, 0, q){
        ll v; cin >> v;
        t.insert(v);
        lis.emplace_back(v);
    }
    for(auto x: cst){
        ll X = get<0>(x), s = get<1>(x), e =  get<2>(x);
        auto r = t.lower_bound(s); auto u = t.upper_bound(e-1);
        //debug(X);
        //debug(s);
        //debug(e);
        iterator f = r;
        rep(i, 0, N){
            if(f == u){
                break;
            }
            ll g = *f;
            vll h = {g, X};
            res.emplace_back(h);
            f = next(f, 1);
        }
        f = r;
        rep(i, 0, N){
            if(f == u){
                break;
            }
            ll g = *f;
            //prt(g); prt(" ");
            t.erase(g);
            f = next(f, 1);
        }
        //prt(endl);
    }
    ll m = 0;
    sort(res.begin(),res.end());
    ll w = sz(res);
    for(auto x: lis){
        if(m < w){
            if(res[m][0] == x){
                prtl(res[m][1]);
                m++;
            }else{
                prtl(-1);
            }
        }else{
            prtl(-1);
        }
    }
}






