#include <bits/stdc++.h>
using namespace std;
const int MN = 300010;
struct BIT {
  vector<int> tree;
  void init() { tree = vector<int>(4 * MN, 0); }
  void upd(int idx, int val, int l, int r, int n) {
    if (idx < l || r < idx) return;
    if (l == r) {
      tree[n] = max(tree[n], val);
      return;
    }
    int m = (l + r) >> 1;
    upd(idx, val, l, m, 2 * n);
    upd(idx, val, m + 1, r, 2 * n + 1);
    tree[n] = max(tree[2 * n], tree[2 * n + 1]);
  }
  int quer(int a, int b, int l, int r, int n) {
    if (b < l || r < a) return 0;
    if (a <= l && r <= b) return tree[n];
    int m = (l + r) >> 1;
    int L = quer(a, b, l, m, 2 * n);
    int R = quer(a, b, m + 1, r, 2 * n + 1);
    return max(L, R);
  }
} bit;
struct BIT2 {
  vector<pair<int, int> > tree;
  void init() {
    tree = vector<pair<int, int> >(4 * MN, pair<int, int>(-1, -1));
  }
  void upd(int idx, pair<int, int> val, int l, int r, int n) {
    if (idx < l || r < idx) return;
    if (l == r) {
      tree[n] = max(tree[n], val);
      return;
    }
    int m = (l + r) >> 1;
    upd(idx, val, l, m, 2 * n);
    upd(idx, val, m + 1, r, 2 * n + 1);
    tree[n] = max(tree[2 * n], tree[2 * n + 1]);
  }
  pair<int, int> quer(int a, int b, int l, int r, int n) {
    if (b < l || r < a) return pair<int, int>(-1, -1);
    if (a <= l && r <= b) return tree[n];
    int m = (l + r) >> 1;
    pair<int, int> L = quer(a, b, l, m, 2 * n);
    pair<int, int> R = quer(a, b, m + 1, r, 2 * n + 1);
    return max(L, R);
  }
} sub;
int N, M, C;
struct Info {
  int t, id, s;
  bool operator<(const Info &i) const { return t < i.t; }
};
vector<Info> upd;
vector<pair<int, int> > seg;
vector<pair<int, int> > ord;
vector<int> cost, inv;
vector<int> X;
vector<pair<int, int> > query;
vector<int> ans;
set<int> st;
map<pair<int, int>, int> cross;
vector<int> single;
int sun;
int main() {
  scanf("%d %d", &N, &C);
  cost.resize(N);
  seg.resize(N);
  for (int i = 0; i < N; i++) {
    int l, r, c;
    scanf("%d %d %d", &l, &r, &c);
    seg[i] = pair<int, int>(l, r);
    X.push_back(l);
    X.push_back(r);
    upd.push_back({l, i, 1});
    upd.push_back({r, i, 0});
    cost[i] = c;
    ord.push_back(pair<int, int>(cost[i], i));
  }
  X.push_back(0);
  X.push_back(2e9);
  sort(X.begin(), X.end());
  X.resize(unique(X.begin(), X.end()) - X.begin());
  sort(ord.begin(), ord.end());
  inv.resize(N);
  for (int i = 0; i < N; i++) inv[ord[i].second] = i;
  scanf("%d", &M);
  query.resize(M);
  for (int i = 0; i < M; i++) {
    scanf("%d", &query[i].first);
    query[i].second = i;
  }
  sort(upd.begin(), upd.end());
  sort(query.begin(), query.end());
  int pos1 = 0, pos2 = 0;
  single = vector<int>(N, 0);
  sun = 0;
  bit.init();
  sub.init();
  ans.resize(M);
  for (int i = 1; i < X.size(); i++) {
    while (pos1 < upd.size() && upd[pos1].t <= X[i - 1]) {
      if (upd[pos1].s)
        st.insert(upd[pos1].id);
      else
        st.erase(st.find(upd[pos1].id));
      pos1++;
    }
    int len = X[i] - X[i - 1];
    while (pos2 < M) {
      if (st.size() > 2) break;
      int s = 0, e = len;
      int p = -1;
      while (s <= e) {
        int m = (1LL * s + e) >> 1;
        int mx;
        if (st.size() == 2) {
          set<int>::iterator it = st.begin();
          int a = *it;
          int b = *(++it);
          mx = sun + bit.tree[1];
          if (cost[a] + cost[b] <= C) {
            mx = max(mx, sun + single[a] + single[b] +
                             cross[pair<int, int>(a, b)] + m);
            mx = max(mx, sun + single[a] + single[b] +
                             cross[pair<int, int>(a, b)] + m);
          }
        } else if (st.size() == 1) {
          int a = *st.begin();
          mx = sun + bit.tree[1];
          if (cost[a] <= C) {
            int t = bit.quer(a, a, 0, MN - 1, 1);
            int ts = 0, te = N - 1;
            int tp = -1;
            while (ts <= te) {
              int tm = (ts + te) >> 1;
              if (ord[tm].first <= C - cost[a]) {
                tp = tm;
                ts = tm + 1;
              } else
                te = tm - 1;
            }
            pair<int, int> d = sub.quer(0, min(inv[a] - 1, tp), 0, MN - 1, 1);
            d = max(d, sub.quer(inv[a] + 1, tp, 0, MN - 1, 1));
            int x =
                d == pair<int, int>(-1, -1)
                    ? t + m
                    : max(t + m,
                          m + single[a] + single[d.second] +
                              (cross.find(pair<int, int>(min(a, d.second),
                                                         max(a, d.second))) ==
                                       cross.end()
                                   ? 0
                                   : cross[pair<int, int>(min(a, d.second),
                                                          max(a, d.second))]));
            mx = max(mx, sun + x);
          }
        } else {
          mx = sun + m + bit.tree[1];
        }
        if (mx >= query[pos2].first) {
          p = m;
          e = m - 1;
        } else
          s = m + 1;
      }
      if (p == -1)
        break;
      else {
        ans[query[pos2].second] = X[i - 1] + p;
        pos2++;
      }
    }
    if (st.size() > 2) continue;
    if (st.size() == 2) {
      set<int>::iterator it = st.begin();
      int a = *it;
      int b = *(++it);
      cross[pair<int, int>(a, b)] += len;
      if (cost[a] + cost[b] <= C) {
        bit.upd(a, single[a] + single[b] + cross[pair<int, int>(a, b)], 0,
                MN - 1, 1);
        bit.upd(b, single[a] + single[b] + cross[pair<int, int>(a, b)], 0,
                MN - 1, 1);
      }
    } else if (st.size() == 1) {
      int a = *st.begin();
      single[a] += len;
      sub.upd(inv[a], pair<int, int>(single[a], a), 0, MN - 1, 1);
      if (cost[a] <= C) {
        int t = bit.quer(a, a, 0, MN - 1, 1);
        int s = 0, e = N - 1;
        int p = -1;
        while (s <= e) {
          int m = (s + e) >> 1;
          if (ord[m].first <= C - cost[a]) {
            p = m;
            s = m + 1;
          } else
            e = m - 1;
        }
        pair<int, int> d = sub.quer(0, min(inv[a] - 1, p), 0, MN - 1, 1);
        d = max(d, sub.quer(inv[a] + 1, p, 0, MN - 1, 1));
        int x = d == pair<int, int>(-1, -1)
                    ? t + len
                    : max(t + len,
                          single[a] + single[d.second] +
                              (cross.find(pair<int, int>(min(a, d.second),
                                                         max(a, d.second))) ==
                                       cross.end()
                                   ? 0
                                   : cross[pair<int, int>(min(a, d.second),
                                                          max(a, d.second))]));
        bit.upd(a, x, 0, MN - 1, 1);
      }
    } else {
      sun += len;
    }
  }
  for (int i = 0; i < M; i++) {
    printf("%d\n", ans[i]);
  }
}
