#include <bits/stdc++.h>
using namespace std;
const int maxn(6e5 + 5);
struct Cloud {
  int x, v, opt, id, l;
  inline int operator<(Cloud b) const { return x == b.x ? id < b.id : x < b.x; }
};
struct Node {
  int l, r, c;
} tmp[maxn];
int n, m, C, tot, k[maxn], id[maxn], ans[maxn], len[maxn], part[maxn];
set<Cloud> S;
Cloud cl[maxn];
map<int, int> cost[maxn];
pair<int, int> mx[maxn << 2];
pair<int, int> o[maxn];
int length;
void Modify(int x, int l, int r, int p, int v) {
  if (l == r)
    mx[x].first = v, mx[x].second = p;
  else {
    int mid = (l + r) >> 1;
    p <= mid ? Modify(x << 1, l, mid, p, v)
             : Modify(x << 1 | 1, mid + 1, r, p, v);
    mx[x] = max(mx[x << 1], mx[x << 1 | 1]);
  }
}
pair<int, int> Query(int x, int l, int r, int ql, int qr) {
  if (ql <= l && qr >= r) return mx[x];
  int mid = (l + r) >> 1;
  pair<int, int> ret = make_pair(0, 0);
  if (ql <= mid) ret = Query(x << 1, l, mid, ql, qr);
  if (qr > mid) ret = max(ret, Query(x << 1 | 1, mid + 1, r, ql, qr));
  return ret;
}
inline int Cost(int x, int y) {
  if (x > y) swap(x, y);
  return len[x] + len[y] + cost[x][y];
}
int main() {
  int i, j, l, ql, qr, x, y, ept = 0, ret = 0, cur = 0, mxv;
  scanf("%d%d", &n, &C);
  for (i = 1; i <= n; ++i) scanf("%d%d%d", &tmp[i].l, &tmp[i].r, &tmp[i].c);
  sort(tmp + 1, tmp + n + 1, [](Node x, Node y) { return x.c < y.c; });
  for (i = 1; i <= n; ++i)
    o[++length] = make_pair(tmp[i].c, i),
    o[++length] = make_pair(C - tmp[i].c, n + 1);
  sort(o + 1, o + length + 1), length = unique(o + 1, o + length + 1) - o - 1;
  for (i = 1; i <= n; ++i) {
    tmp[i].c = lower_bound(o + 1, o + length + 1, make_pair(tmp[i].c, i)) - o;
    cl[++tot] = (Cloud){tmp[i].l, o[tmp[i].c].first, 1, tmp[i].c, tmp[i].l};
    cl[++tot] = (Cloud){tmp[i].r, o[tmp[i].c].first, -1, tmp[i].c, tmp[i].l};
  }
  sort(cl + 1, cl + tot + 1),
      cl[++tot] = (Cloud){(int)2e9 + 1, (int)2e9, 1, n + 1};
  scanf("%d", &m);
  for (i = 1; i <= m; ++i) scanf("%d", &k[i]), id[i] = i;
  sort(id + 1, id + m + 1, [](int x, int y) { return k[x] < k[y]; });
  for (i = 1, j = 1; i <= tot; ++i) {
    l = cl[i].x - cur, cur = cl[i].x;
    if (!S.size())
      ept += l;
    else if (S.size() == 1) {
      x = S.begin()->id, len[x] += l, part[x] += l;
      Modify(1, 1, length, x, len[x]);
      if (S.begin()->v <= C) {
        ql = 1,
        qr = lower_bound(o + 1, o + length + 1,
                         make_pair(C - S.begin()->v, n + 1)) -
             o,
        mxv = len[x];
        if (ql <= x && x <= qr) {
          if (ql < x)
            mxv = max(mxv, Cost(x, Query(1, 1, length, ql, x - 1).second));
          if (qr > x)
            mxv = max(mxv, Cost(x, Query(1, 1, length, x + 1, qr).second));
        } else if (ql <= qr)
          mxv = max(mxv, Cost(x, Query(1, 1, length, ql, qr).second));
        part[x] = max(part[x], mxv), ret = max(ret, part[x]);
      }
    } else if (S.size() == 2) {
      x = S.begin()->id, y = S.rbegin()->id;
      if (x > y) swap(x, y);
      cost[x][y] += l;
      if (S.begin()->v + S.rbegin()->v <= C) {
        part[x] = max(part[x], Cost(x, y));
        part[y] = max(part[y], Cost(x, y));
        ret = max(ret, max(part[x], part[y]));
      }
    }
    while (j <= m && ret + ept >= k[id[j]])
      ans[id[j]] = cur - (ret + ept - k[id[j]]), ++j;
    if (cl[i].opt == 1)
      S.insert(cl[i]);
    else
      S.erase((Cloud){cl[i].l, cl[i].v, cl[i].opt, cl[i].id, cl[i].l});
  }
  for (i = 1; i <= m; ++i) printf("%d\n", ans[i]);
  return 0;
}
