#include <bits/stdc++.h>

using namespace std;
inline void
prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
//printf("%.12lf\n",mid);
int mod;

int mymod(int num){
  if (num< 0){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

int main ()
{
  prep ();
  
  int n, q;
  cin >> n >> q;
  vector<pair<int, pair<int, int> > > invs;
  vector<int> orig;
  for (int i=0; i<n; i++){
    int s, t, h;
    cin >> s >> t >> h;
    invs.push_back({h, {s, t}});
  }
  sort(invs.begin(), invs.end());
  vector<int> strts;
  for (int i=0; i<q; i++){
    int strt;
    cin >> strt;
    strts.push_back(strt);
    orig.push_back(strt);
  }
  sort(strts.begin(), strts.end());
  vector<int> goods[n];
  for (int i=0; i<n; i++){
    int beginx = invs[i].second.first-invs[i].first;
    int endx = invs[i].second.second-invs[i].first-1;
    vector<int>::iterator bttm = upper_bound(strts.begin(), strts.end(), beginx-1);
    vector<int>::iterator tp = upper_bound(strts.begin(), strts.end(), endx)-1;
    int bttmind = bttm-strts.begin();
    int tpind = tp-strts.begin();
    if (bttmind < 0 && tpind < 0){
        continue;
    }
    if (bttmind > tpind){
        continue;
    }
    if (bttmind < 0){
        bttmind = 0;
        bttm = strts.begin();
    }
    
    for (int j=0; j<strts.size(); j++){
        //cout << strts[j] << " ";
    }
    //cout << endl;
    //cout << bttmind << " " << tpind << endl;
    //cout << beginx << " " << endx<< endl;
    vector<int> separate;
    for (int j=bttmind; j<=tpind; j++){
        separate.push_back(strts[j]);
    }
    goods[i] = separate;
    strts.erase(bttm, tp+1);
    /*cout << bttmind << " " << tpind << endl;
    for (int j=0; j<strts.size(); j++){
        cout << strts[j] << " ";
    }
    cout << endl;*/
  }
  map<int, int> stops;
  for (int i=0; i<n; i++){
    for (int j=0; j<goods[i].size(); j++){
        stops[goods[i][j]] = invs[i].first;
    }
  }
  for (int i=0; i<q; i++){
      auto thiss = stops.find(orig[i]);
      if (thiss == stops.end()){
          cout << -1 << endl;
      }else{
          cout << thiss->second << endl;
      }
  }
  return 0;
}
// in dp problems think: up until here, intervals, or "what if there's 1, 2, 3..."
// in math problems write out equations
// also in math problems to change multiplication/division to addition/subtraction use logs, add/subtract something to make the multiplication easier (like if it's 3*f(x)+2, change it to 3*(f(x)+1)-1)
// if printint pow function, put an (int) or (long long) next to it
// if checked everything check for bugs (like sorting wrong way or not putting a break in a loop)
// if n is 10^7 try brute force if the operations are simple
// if can't do dp do brute force/greedy
// to save time don't copy maps/vectors into variables if it already exists
// only use long long if need to
// if wrong on decimal problem, check if program rounds or if you can round to a certain amt of decimals
// if decimals too, if can subtract instead of divide
// in grid traversal problems check if doing sideways or not
// if TLE try to take away loop
// in recursion looking math problems look at things from the point of view of both sides (the start and the end sections of the recursion)
// think about how many possible answers there are to the problem
// if it makes it easier use +1 indexing
// think twice when writing things down that you're going to use later


Measured memory_bytes: 20976