#include <bits/stdc++.h>
using namespace std;
struct node {
  long long det, f;
  friend node operator+(const node &x, const node &y) {
    node ret;
    ret.det = 0;
    ret.f = max(x.f, y.f);
    return ret;
  }
} tree[200010 << 2];
int st[200010], aim[200010], nxt[200010], d[200010], ln;
int a[200010];
long long sa[200010];
long long f[200010];
int n, m;
void in_edge(int x, int y, int z) {
  aim[ln] = y;
  nxt[ln] = st[x];
  d[ln] = z;
  st[x] = ln++;
}
void push_down(int p) {
  if (tree[p].det) {
    tree[p << 1].det += tree[p].det;
    tree[p << 1].f += tree[p].det;
    tree[(p << 1) + 1].det += tree[p].det;
    tree[(p << 1) + 1].f += tree[p].det;
    tree[p].det = 0;
  }
}
void ins_f(int p, int tl, int tr, int k, long long v) {
  if (tl == tr) {
    tree[p].f = v;
    tree[p].det = 0;
    return;
  }
  push_down(p);
  int m = (tl + tr) >> 1;
  if (k <= m)
    ins_f(p << 1, tl, m, k, v);
  else
    ins_f((p << 1) + 1, m + 1, tr, k, v);
  tree[p] = tree[p << 1] + tree[(p << 1) + 1];
}
void ins(int p, int tl, int tr, int l, int r, long long v) {
  if (tl == l && tr == r) {
    tree[p].det += v;
    tree[p].f += v;
    return;
  }
  push_down(p);
  int m = (tl + tr) >> 1;
  if (l <= m) {
    if (r > m) {
      ins(p << 1, tl, m, l, m, v);
      ins((p << 1) + 1, m + 1, tr, m + 1, r, v);
    } else
      ins(p << 1, tl, m, l, r, v);
  } else
    ins((p << 1) + 1, m + 1, tr, l, r, v);
  tree[p] = tree[p << 1] + tree[(p << 1) + 1];
}
long long ask(int p, int tl, int tr, int l, int r) {
  if (tl == l && tr == r) return tree[p].f;
  push_down(p);
  int m = (tl + tr) >> 1;
  long long ret;
  if (l <= m) {
    if (r > m) {
      ret =
          max(ask(p << 1, tl, m, l, m), ask((p << 1) + 1, m + 1, tr, m + 1, r));
    } else
      ret = ask(p << 1, tl, m, l, r);
  } else
    ret = ask((p << 1) + 1, m + 1, tr, l, r);
  tree[p] = tree[p << 1] + tree[(p << 1) + 1];
  return ret;
}
int main() {
  memset(st, -1, sizeof(st));
  ln = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  sa[0] = 0;
  for (int i = 1; i <= n; i++) sa[i] = sa[i - 1] + a[i];
  for (int i = 0; i < m; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    in_edge(v, u, w);
  }
  f[0] = 0;
  ins_f(1, 1, n, 1, f[0]);
  for (int i = 1; i <= n; i++) {
    for (int j = st[i]; j != -1; j = nxt[j]) ins(1, 1, n, 1, aim[j], d[j]);
    long long v = ask(1, 1, n, 1, i);
    f[i] = max(f[i - 1], v - sa[i]);
    if (i < n) ins_f(1, 1, n, i + 1, f[i] + sa[i]);
  }
  printf("%I64d\n", f[n]);
  return 0;
}
