#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int MAX = 2e5 + 5;
const long long MAX2 = 11;
const long long MOD = 1000000007;
const long long MOD2 = 1000005329;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 312;
int n, m, a, b, c, x[MAX];
long long tree[1 << 19], lz[1 << 19], ans, val;
vector<pair<int, int> > v[MAX];
inline void f(int id, int le, int ri) {
  tree[id] += lz[id];
  if (le != ri) lz[(id << 1)] += lz[id], lz[((id << 1) | 1)] += lz[id];
  lz[id] = 0;
  return;
}
void upd(int id, int le, int ri) {
  if (lz[id]) f(id, le, ri);
  if (le > b || ri < a) return;
  if (le >= a && ri <= b) {
    lz[id] = val;
    f(id, le, ri);
    return;
  }
  int mid = le + ri >> 1;
  upd((id << 1), le, mid), upd(((id << 1) | 1), mid + 1, ri);
  tree[id] = max(tree[(id << 1)], tree[((id << 1) | 1)]);
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> x[i];
  for (int i = 1; i <= m; ++i) {
    cin >> a >> b >> c;
    v[b].push_back({a, c});
  }
  for (int i = 1; i <= n; ++i) {
    a = b = i, val = ans;
    upd(1, 1, n);
    a = 1, b = i, val = -x[i];
    upd(1, 1, n);
    for (pair<int, int> j : v[i]) b = j.first, val = j.second, upd(1, 1, n);
    ans = max(ans, tree[1]);
  }
  cout << ans << '\n';
  return 0;
}
