#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 2e5 + 100;
int n, m;
long long cost[MAXN], lazy[MAXN << 2], maxa[MAXN << 2];
struct Race {
  int l, r;
  long long va;
  bool operator<(const Race &a) const { return r < a.r; }
} ra[MAXN];
void Updata(int id, int l, int r, int li, int ri, long long v) {
  if (li <= l && r <= ri) {
    lazy[id] += v;
    maxa[id] += v;
    return;
  }
  if (lazy[id]) {
    lazy[id * 2] += lazy[id];
    lazy[id * 2 + 1] += lazy[id];
    maxa[id * 2] += lazy[id];
    maxa[id * 2 + 1] += lazy[id];
    lazy[id] = 0;
  }
  int mid = (l + r) >> 1;
  if (li <= mid) Updata(id * 2, l, mid, li, ri, v);
  if (ri > mid) Updata(id * 2 + 1, mid + 1, r, li, ri, v);
  maxa[id] = max(maxa[id * 2], maxa[id * 2 + 1]);
  return;
}
long long Query(int id, int l, int r, int li, int ri) {
  if (li <= l && r <= ri) return maxa[id];
  if (lazy[id]) {
    lazy[id * 2] += lazy[id];
    lazy[id * 2 + 1] += lazy[id];
    maxa[id * 2] += lazy[id];
    maxa[id * 2 + 1] += lazy[id];
    lazy[id] = 0;
  }
  int mid = (l + r) >> 1;
  long long ans = 0;
  if (li <= mid) ans = max(ans, Query(id * 2, l, mid, li, ri));
  if (ri > mid) ans = max(ans, Query(id * 2 + 1, mid + 1, r, li, ri));
  maxa[id] = max(maxa[id * 2], maxa[id * 2 + 1]);
  return ans;
}
long long dp[MAXN];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &cost[i]);
  for (int i = 1; i <= m; i++)
    scanf("%d %d %lld", &ra[i].l, &ra[i].r, &ra[i].va);
  sort(ra + 1, ra + 1 + m);
  int k = 1;
  for (int i = 1; i <= n; i++) {
    Updata(1, 0, n, 0, i - 1, -cost[i]);
    while (k <= m && ra[k].r <= i) {
      Updata(1, 0, n, 0, ra[k].l - 1, ra[k].va);
      k++;
    }
    dp[i] = max(dp[i - 1], Query(1, 0, n, 0, i - 1));
    Updata(1, 0, n, i, i, dp[i]);
  }
  cout << dp[n] << endl;
  return 0;
}
