#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
long long mod = 1e9 + 7;
const int N = 3e5 + 500;

long long n, m, u, v, k, t, q, a, h;

pair <string, int> rest[N];

int tree[4 * N];
bool lazy[4 * N];

void init(int l, int r, int i) {
   if (l == r) {
      tree[i] = 1;
      return;
   } else {
      int mid = (l + r) / 2;
      init(l, mid, i + 1 + i);
      init(mid + 1, r, i + 2 + i);
      tree[i] = tree[i + 1 + i] + tree[i + 2 + i];
   }
}

void push(int l, int r, int i) {
   if (lazy[i]) {
      tree[i] = 0;
      lazy[i + 1 + i] = true;
      lazy[i + 2 + i] = true;
   }
}

int get(int l, int r, int i, int rl, int rr) {
   if (rl <= l and r <= rr) {
      push(l, r, i);
      return tree[i];
   } else if (l > rr or rl > r) return 0;
   push(l, r, i);
   int mid = (l + r) / 2;
   return get(l, mid, i + 1 + i, rl, rr) + get(mid + 1, r, i + 2 + i, rl, rr);
}

void modify(int l, int r, int i, int rl, int rr) {
   if (rl <= l and r <= rr) {
      lazy[i] = true;
      tree[i] = 0;
      return;
   } else if (l > rr or rl > r) return;
   push(l, r, i);
   int mid = (l + r) / 2;
   modify(l, mid, i + 1 + i, rl, rr);
   modify(mid + 1, r, i + 2 + i, rl, rr);
   tree[i] = tree[i + 1 + i] + tree[i + 2 + i];
}
int S[N], T[N], X[N], D[N];

pair < pair <int, int>, int> V[N];

vector <pair <int, int> > R[N];
int sol[N];

int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n >> q;
   
   for (int i = 1; i <= n; ++i) {
      cin >> S[i] >> T[i] >> X[i];
      V[i] = make_pair(make_pair(X[i], S[i]), T[i]);
   }
   sort(V + 1, V + 1 + n);
   
   for (int i = 1; i <= n; ++i) {
      X[i] = V[i].first.first;
      S[i] = V[i].first.second;
      T[i] = V[i].second;
   }
   
   for (int i = 1; i <= q; ++i) {
      cin >> D[i];
   }
   sort(D + 1, D + 1 + q);
   init(1, q, 0);
   
   long long solution = 0;
   
   for (int i = 1; i <= n; ++i) {
      int l = S[i], r = T[i] - 1;
      l -= X[i];
      r -= X[i];
      l = lower_bound(D + 1, D + 1 + q, l) - D;
      r = upper_bound(D + 1, D + 1 + q, r) - D - 1;
      //cout << l << " " << r << " ";
      if (l > r) continue;
      solution += get(1, q, 0, l, r) * X[i];
      modify(1, q, 0, l, r);
      R[l].push_back(make_pair(X[i], 1));
      R[r + 1].push_back(make_pair(X[i], -1));
      //cout << solution << endl;
   }
   
   multiset<int> elem;
   
   for (int i = 1; i <= q; ++i) {
      for (int j = 0; j < R[i].size(); ++j) {
         //cout << R[i][j].first << " " << R[i][j].second << " " << elem.size() << endl;
         if (R[i][j].second == 1) elem.insert(R[i][j].first);
         else elem.erase(elem.find(R[i][j].first));
      }
      if (elem.size() == 0) sol[i] = -1;
      else sol[i] = (*elem.begin());
   }
   
   for (int i = 1; i <= q; ++i){
      cout << sol[i] << '\n';
   }
}






Measured memory_bytes: 45160