#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 100;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
long long n, m, ans, a[maxn], dp[maxn], seg[maxn], lz[maxn];
vector<pair<long long, long long> > g[maxn];
void pushlz(long long id) {
  seg[id * 2] += lz[id];
  seg[id * 2 + 1] += lz[id];
  lz[id * 2] += lz[id];
  lz[id * 2 + 1] += lz[id];
  lz[id] = 0;
}
void upd(long long id, long long s, long long e, long long l, long long r,
         long long x) {
  if (r <= s || e <= l) return;
  if (l <= s && e <= r) {
    seg[id] += x;
    lz[id] += x;
    return;
  }
  long long mid = (s + e) / 2;
  pushlz(id);
  upd(id * 2, s, mid, l, r, x);
  upd(id * 2 + 1, mid, e, l, r, x);
  seg[id] = max(seg[id * 2], seg[id * 2 + 1]);
  return;
}
long long get(long long id, long long s, long long e, long long l,
              long long r) {
  if (r <= s || e <= l) return 0;
  if (l <= s && e <= r) return seg[id];
  long long mid = (s + e) / 2;
  pushlz(id);
  return max(get(id * 2, s, mid, l, r), get(id * 2 + 1, mid, e, l, r));
}
int main() {
  long long l, r, c, s = 0;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  n++;
  for (long long i = 1; i < n; i++) {
    cin >> a[i];
    s += a[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> l >> r >> c;
    g[r].push_back(make_pair(l, c));
  }
  for (long long i = 1; i < n; i++) {
    dp[i] = get(1, 0, n, 0, i) + a[i];
    upd(1, 0, n, i, i + 1, dp[i]);
    for (long long j = 0; j < g[i].size(); j++) {
      upd(1, 0, n, 0, g[i][j].first, g[i][j].second);
    }
  }
  cout << get(1, 0, n, 0, n) - s;
  return 0;
}
