#include <bits/stdc++.h>
using namespace std;
const long long N = 200005;
long long n, m, c[N], dp[N];
struct node {
  long long l, r, w;
} a[N];
bool operator<(node a, node b) { return a.r < b.r; }
long long maxv[N << 2], addv[N << 2];
inline void update(long long o, long long w) { addv[o] += w, maxv[o] += w; }
inline void pushup(long long o) {
  maxv[o] = max(maxv[(o << 1)], maxv[(o << 1 | 1)]);
}
inline void pushdown(long long o) {
  if (addv[o])
    update((o << 1), addv[o]), update((o << 1 | 1), addv[o]), addv[o] = 0;
}
inline void modify(long long o, long long l, long long r, long long ql,
                   long long qr, long long w) {
  if (ql <= l && r <= qr) {
    update(o, w);
    return;
  }
  long long mid = (l + r) >> 1;
  pushdown(o);
  if (ql <= mid) modify((o << 1), l, mid, ql, qr, w);
  if (qr > mid) modify((o << 1 | 1), mid + 1, r, ql, qr, w);
  pushup(o);
}
inline long long query(long long o, long long l, long long r, long long ql,
                       long long qr) {
  if (ql <= l && r <= qr) return maxv[o];
  long long mid = (l + r) >> 1;
  long long res = 0;
  pushdown(o);
  if (ql <= mid) res = max(res, query((o << 1), l, mid, ql, qr));
  if (qr > mid) res = max(res, query((o << 1 | 1), mid + 1, r, ql, qr));
  pushup(o);
  return res;
}
signed main() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; ++i) scanf("%lld", &c[i]);
  for (long long i = 1; i <= m; ++i)
    scanf("%lld%lld%lld", &a[i].l, &a[i].r, &a[i].w);
  sort(a + 1, a + m + 1);
  for (long long i = 1, p = 1; i <= n; ++i) {
    while (p <= m && a[p].r <= i) modify(1, 0, n, 0, a[p].l - 1, a[p].w), ++p;
    modify(1, 0, n, 0, i - 1, -c[i]);
    dp[i] = max(dp[i - 1], query(1, 0, n, 0, i - 1));
    modify(1, 0, n, i, i, dp[i]);
  }
  printf("%lld\n", dp[n]);
  return 0;
}
