#include <bits/stdc++.h>
typedef long long int LL;
using namespace std;

// 插入此處
template <typename T>
class SegmentTree {
public:
    SegmentTree(int n): n(n) {
        idxMax = 1;
        while (idxMax < n) {
            idxMax <<= 1;
        }
        idxMax <<= 1;
        sum.insert(sum.end(), idxMax, 0);
        mi.insert(mi.end(), idxMax, 0);
        ma.insert(ma.end(), idxMax, 0);
        addVal.insert(addVal.end(), idxMax, 0);
        setVal.insert(setVal.end(), idxMax, -1);  // value -1 means no setVal
        rl.insert(rl.end(), idxMax, 0);  // the range of idx i node is [rl[i], rr[i]]
        rr.insert(rr.end(), idxMax, 0);
        __init(1, 1, n);
    } 
    void update_set(int L, int R, T val) {  __update_set(1, L, R, val); }
    void update_add(int L, int R, T val) {  __update_add(1, L, R, val); }
    T query_sum(int L, int R) {  return __query_sum(1, L, R); }
    T query_min(int L, int R) {  return __query_min(1, L, R); }
    T query_max(int L, int R) {  return __query_max(1, L, R); }
    void trace(int idx);  // (debugger) print the information
private:
    int n, idxMax;
    void __init(int idx, int L, int R);  // idx start from 1
    void __push_down(int idx);
    void __update_set(int idx, int L, int R, T val);  // set [L, R] as value val
    void __update_add(int idx, int L, int R, T val);  // add [L, R] by value val
    T __query_sum(int idx, int L, int R);  // initial idx is 1
    T __query_min(int idx, int L, int R);  // initial idx is 1
    T __query_max(int idx, int L, int R);  // initial idx is 1
    vector<T> sum, mi, ma, addVal, setVal;
    vector<int> rl, rr;
};

template <typename T>
void SegmentTree<T>::__init(int idx, int L, int R) {  // idx start from 1
    rl[idx] = L; rr[idx] = R;
    if (L != R) {
        int mid = (L + R) / 2;
        int lc = (idx << 1), rc = (idx << 1) + 1;
        __init(lc, L, mid);
        __init(rc, mid + 1, R);
    }
}

template <typename T>
void SegmentTree<T>::__push_down(int idx) {
    if (rl[idx] == rr[idx])  return;
    int lc = (idx << 1), rc = (idx << 1) + 1;
    if (setVal[idx] != -1){
        if (setVal[lc] == -1) {
            setVal[lc] = setVal[idx];
        }
        if (setVal[rc] == -1) {
            setVal[rc] = setVal[idx];
        }
        setVal[idx] = -1;
    }
    if (addVal[idx] != 0){
        addVal[lc] += addVal[idx];
        addVal[rc] += addVal[idx];
        sum[lc] += addVal[idx] * (rr[lc] - rl[lc] + 1);
        sum[rc] += addVal[idx] * (rr[rc] - rl[rc] + 1);
        mi[lc] += addVal[idx];
        mi[rc] += addVal[idx];
        ma[lc] += addVal[idx];
        ma[rc] += addVal[idx];
        addVal[idx] = 0;
    }
}

template <typename T>
void SegmentTree<T>::__update_set(int idx, int L, int R, T val) {  // set [L, R] as value val
    if (rl[idx] == L && rr[idx] == R) {
        if (setVal[idx] == -1) {
            setVal[idx] = val;
        }
        return;
    }
    __push_down(idx);
    int mid = (rl[idx] + rr[idx]) / 2;
    int lc = (idx << 1), rc = (idx << 1) + 1;
    if (R <= mid) {
        __update_set(lc, L, R, val);
    } else if (L >= mid + 1) {
        __update_set(rc, L, R, val);
    } else {
        __update_set(lc, L, mid, val);
        __update_set(rc, mid + 1, R, val);
    }
}

template <typename T>
void SegmentTree<T>::__update_add(int idx, int L, int R, T val) {  // add [L, R] by value val
    return;
}

template <typename T>
T SegmentTree<T>::__query_sum(int idx, int L, int R) {
    if (rl[idx] == L && rr[idx] == R) {
        return setVal[idx];
    }
    __push_down(idx);
    int mid = (rl[idx] + rr[idx]) / 2;
    int lc = (idx << 1), rc = (idx << 1) + 1;
    if (R <= mid) {
        return __query_sum(lc, L, R);
    } else if (L >= mid + 1) {
        return __query_sum(rc, L, R);
    } else {
        return __query_sum(lc, L, mid) + __query_sum(rc, mid + 1, R);
    }
}

template <typename T>
T SegmentTree<T>::__query_min(int idx, int L, int R) {
    return;
}

template <typename T>
T SegmentTree<T>::__query_max(int idx, int L, int R) {
    return;
}

template <typename T>
void SegmentTree<T>::trace(int idx) {
    printf("idx %d rl %d rr %d setVal %d addVal %d sum %d min %d max %d\n", idx, rl[idx], rr[idx], setVal[idx], addVal[idx], sum[idx]);  // FIXME how to determine the type T that needs to use in printf?
    if (rl[idx] < rr[idx]) {
        trace(idx << 1);
        trace((idx << 1) + 1);
    }
}


int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int N, Q; cin >> N >> Q;
    vector<tuple<int, int, int>> v;
    for (int i = 0; i < N; ++i) {
        int S, T, X; cin >> S >> T >> X;
        v.push_back(make_tuple(X, S, T));
    }
    sort(v.begin(), v.end());
    vector<int> D(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> D[i];
    }
    SegmentTree<int> st(Q+2);
    for (auto x : v) {
        int X = get<0>(x), S = get<1>(x), T = get<2>(x);
        int L = lower_bound(D.begin(), D.end(), S-X) - D.begin();
        int R = upper_bound(D.begin(), D.end(), T-1-X) - D.begin();
        // cout << "X " << X << " L " << L << " R " << R << endl;
        if (L == Q || R == 0)  continue;
        if (L+1 > R)  continue;
        st.update_set(L+1, R, X);
    }
    for (int i = 0; i < Q; ++i) {
        cout << st.query_sum(i+1, i+1) << endl;
    }
    return 0;
}


Measured memory_bytes: 19824