#include <bits/stdc++.h>
using namespace std;
long long Plus[100500];
long long cntQ[100500];
int q[100500];
int l[100500];
int r[100500];
int t[100500];
int n, m;
multiset<int> curTimes;
map<int, vector<int>> opaopa;
void calc(int l, int r, int t) {
  int ind1 = lower_bound(q, q + n, t - r) - q;
  int ind2 = lower_bound(q, q + n, t - l) - q;
  Plus[ind1] += r - t;
  Plus[ind2] -= r - t;
  Plus[ind2] += r - l;
  cntQ[ind1] += 1;
  cntQ[ind2] -= 1;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int l, r, t;
    scanf("%d %d %d", &l, &r, &t);
    opaopa[l].push_back(t);
    opaopa[r].push_back(-t - 1);
  }
  for (int i = 0; i < n; ++i) scanf("%d", &q[i]);
  int prev = -1;
  for (const auto &it : opaopa) {
    int cur = it.first;
    if (curTimes.empty() == false) {
      calc(prev, cur, *curTimes.begin());
    }
    for (int i : it.second) {
      if (i < 0)
        curTimes.erase(curTimes.find(-(i + 1)));
      else
        curTimes.insert(i);
    }
    prev = cur;
  }
  for (int i = 1; i < n; ++i) Plus[i] += Plus[i - 1];
  for (int i = 1; i < n; ++i) cntQ[i] += cntQ[i - 1];
  for (int i = 0; i < n; ++i) printf("%I64d\n", Plus[i] + cntQ[i] * q[i]);
  return 0;
}
