#include <bits/stdc++.h>
using namespace std;
long long a[200010], dp[200010];
struct Gain {
  int x, y;
  long long val;
  friend bool operator<(Gain a, Gain b) { return a.y < b.y; }
} g[200010];
struct node {
  long long cover, val;
} tree[200010 << 2];
inline void pushUp(int rt) {
  tree[rt].val = max(tree[rt << 1].val, tree[rt << 1 | 1].val);
}
inline void pushDown(int rt) {
  if (tree[rt].cover) {
    tree[rt << 1].cover += tree[rt].cover;
    tree[rt << 1 | 1].cover += tree[rt].cover;
    tree[rt << 1].val += tree[rt].cover;
    tree[rt << 1 | 1].val += tree[rt].cover;
    tree[rt].cover = 0;
  }
}
void update(int x, int y, long long val, int L, int R, int rt) {
  if (x <= L && R <= y) {
    tree[rt].cover += val;
    tree[rt].val += val;
  } else {
    int mid = (L + R) >> 1;
    pushDown(rt);
    if (x <= mid) update(x, y, val, L, mid, rt << 1);
    if (y > mid) update(x, y, val, mid + 1, R, rt << 1 | 1);
    pushUp(rt);
  }
}
int main() {
  int i, j, n, m;
  while (~scanf("%d%d", &n, &m)) {
    for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
    for (i = 0; i < m; i++) scanf("%d%d%I64d", &g[i].x, &g[i].y, &g[i].val);
    sort(g, g + m);
    memset(dp, 0, sizeof(dp));
    memset(tree, 0, sizeof(tree));
    for (i = 1, j = 0; i <= n; i++) {
      update(1, i, -a[i], 1, n, 1);
      for (; j < m && g[j].y <= i; j++) update(1, g[j].x, g[j].val, 1, n, 1);
      dp[i] = max(dp[i - 1], tree[1].val);
      if (i <= n) update(i + 1, i + 1, dp[i], 1, n, 1);
    }
    printf("%I64d\n", dp[n]);
  }
  return 0;
}
