#include <bits/stdc++.h>
using namespace std;
long long N, M;
const long long NMax = 200005;
struct Race {
  long long left, right, p;
} Array[NMax];
long long Value[NMax];
long long Partial[NMax];
long long Arb[NMax];
long long DP[NMax];
long long Lazy[4 * NMax];
vector<pair<long long, long long> > Poz[NMax];
long long Aint[4 * NMax];
inline bool cmp(Race a, Race b) {
  return make_pair(a.right, a.left) > make_pair(b.right, b.left);
}
void updateTree(long long K, long long L, long long R, long long x, long long y,
                long long val) {
  if (Lazy[K] != 0) {
    Aint[K] += Lazy[K];
    if (L != R) {
      Lazy[K * 2] += Lazy[K];
      Lazy[K * 2 + 1] += Lazy[K];
    }
    Lazy[K] = 0;
  }
  if (L > R || L > y || R < x) return;
  if (L >= x && R <= y) {
    Aint[K] += val;
    if (L != R) {
      Lazy[2 * K] += val;
      Lazy[2 * K + 1] += val;
    }
    return;
  }
  updateTree(K * 2 + 1, (L + R) / 2 + 1, R, x, y, val);
  updateTree(K * 2, L, (L + R) / 2, x, y, val);
  Aint[K] = max(Aint[K * 2], Aint[K * 2 + 1]);
}
long long Query(long long K, long long L, long long R, long long x,
                long long y) {
  if (Lazy[K] != 0) {
    Aint[K] += Lazy[K];
    if (L != R) {
      Lazy[K * 2] += Lazy[K];
      Lazy[K * 2 + 1] += Lazy[K];
    }
    Lazy[K] = 0;
  }
  if (L > R || L > y || R < x) return -100000000000000000;
  if (L >= x && R <= y) return Aint[K];
  long long a = Query(K * 2, L, (L + R) / 2, x, y);
  long long b = Query(K * 2 + 1, (L + R) / 2 + 1, R, x, y);
  return max(a, b);
}
void Update(long long poz, long long val) {
  while (poz <= N) {
    Arb[poz] += val;
    poz += (poz & (-poz));
  }
}
long long sum(long long poz) {
  long long ans = 0;
  while (poz >= 1) {
    ans += Arb[poz];
    poz -= (poz & (-poz));
  }
  return ans;
}
void Read() {
  scanf("%d%d", &N, &M);
  for (long long i = 1; i <= N; i++) {
    scanf("%d", &Value[i]);
    Partial[i] = Partial[i - 1] + Value[i];
  }
  for (long long i = 1; i <= M; i++) {
    scanf("%d%d%d", &Array[i].left, &Array[i].right, &Array[i].p);
    Poz[Array[i].right].push_back(make_pair(Array[i].left, Array[i].p));
  }
}
void Solve() {
  long long Max = 0;
  updateTree(1, 1, N, 1, 1, 0);
  for (long long i = 1; i <= N; i++) {
    sort(Poz[i].begin(), Poz[i].end());
    reverse(Poz[i].begin(), Poz[i].end());
    for (long long j = 0; j < Poz[i].size(); j++) {
      long long l = Poz[i][j].first, p = Poz[i][j].second;
      Update(l, p);
      updateTree(1, 1, N, l + 1, N, -p);
    }
    if (Poz[i].size() != 0)
      DP[i] = Query(1, 1, N, 1, i) - Partial[i] + sum(i);
    else
      DP[i] = -1;
    DP[i] = max(DP[i], DP[i - 1]);
    Max = max(Max, DP[i]);
    updateTree(1, 1, N, i + 1, i + 1, DP[i] + Partial[i]);
  }
  cout << Max << "\n";
}
int main() {
  Read();
  Solve();
  return 0;
}
