#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
long long val[MAXN << 2], lz[MAXN << 2], s[MAXN], f[MAXN];
int n, m, c[MAXN];
struct race {
  int l, r, p;
  bool operator<(const race &b) const { return r < b.r; }
} r[MAXN];
void pushdown(int o) {
  if (lz[o]) {
    val[o << 1] += lz[o];
    val[o << 1 | 1] += lz[o];
    lz[o << 1] += lz[o];
    lz[o << 1 | 1] += lz[o];
    lz[o] = 0;
  }
}
void update(int xl, int xr, long long v, int o = 1, int l = 0, int r = n) {
  if (xl == l && xr == r) {
    val[o] += v;
    lz[o] += v;
    return;
  }
  pushdown(o);
  int mid = l + r >> 1;
  if (xr <= mid)
    update(xl, xr, v, o << 1, l, mid);
  else if (xl > mid)
    update(xl, xr, v, o << 1 | 1, mid + 1, r);
  else
    update(xl, mid, v, o << 1, l, mid),
        update(mid + 1, xr, v, o << 1 | 1, mid + 1, r);
  val[o] = max(val[o << 1], val[o << 1 | 1]);
}
long long query(int xl, int xr, int o = 1, int l = 0, int r = n) {
  if (l == xl && r == xr) return val[o];
  pushdown(o);
  int mid = l + r >> 1;
  if (xr <= mid)
    return query(xl, xr, o << 1, l, mid);
  else if (xl > mid)
    return query(xl, xr, o << 1 | 1, mid + 1, r);
  else
    return max(query(xl, mid, o << 1, l, mid),
               query(mid + 1, xr, o << 1 | 1, mid + 1, r));
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]), s[i] = s[i - 1] + c[i];
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &r[i].l, &r[i].r, &r[i].p);
  }
  sort(r + 1, r + m + 1);
  f[0] = 0;
  for (int i = 1, j = 1; i <= n; i++) {
    f[i] = f[i - 1];
    while (j <= m && r[j].r <= i) {
      update(0, r[j].l - 1, r[j].p);
      j++;
    }
    update(i, i, s[i]);
    f[i] = max(f[i], query(0, i - 1) - s[i]);
    update(i, i, f[i]);
  }
  printf("%lld\n", f[n]);
  return 0;
}
