#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9 + 7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge {
 public:
  int from, to, value;
  Edge(LL a, LL b, LL c) {
    from = a;
    to = b;
    value = c;
  }
  Edge(LL a, LL b) {
    from = a;
    to = b;
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int N, M;
  cin >> N >> M;
  vector<pair<LL, LL>> world;
  for (int a = 0; a < N; a++) {
    int b, c, d;
    cin >> b >> c >> d;
    world.push_back(make_pair(d - b, d));
    world.push_back(make_pair(d - c, d));
  }
  for (int a = 0; a < M; a++) {
    int b;
    cin >> b;
    world.push_back(make_pair(-b, -1));
  }
  sort(world.begin(), world.end());
  unordered_set<LL> se;
  for (int a = world.size() - 1; a >= 0; a--) {
    pair<LL, LL> pa = world.at(a);
    if (pa.second == -1) {
      if (se.empty()) {
        cout << -1 << endl;
      } else {
        cout << *upper_bound(se.begin(), se.end(), -1e18) << endl;
        ;
      }
    } else {
      if (se.find(pa.second) == se.end()) {
        se.insert(pa.second);
      } else {
        se.erase(pa.second);
      }
    }
  }
}
