#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 200100;
int n;
int m;
int cost[N];
long long dp[N];
vector<pair<int, int> > V[N];
long long T[(1 << 21) + 10][2];
int off = 1;
int lo, hi;
inline void load() {
  scanf("%d %d", &n, &m);
  while (off < n) off <<= 1;
  for (int i = 1; i <= n; i++) scanf("%d", cost + i);
  for (int i = 1; i <= m; i++) {
    int x, y, p;
    scanf("%d %d %d", &x, &y, &p);
    V[y].push_back(make_pair(x, p));
  }
}
long long VAL;
inline long long veci(long long a, long long b) { return a > b ? a : b; }
inline void refresh(int a, int b, int node) {
  b = min(b, n - 1);
  if (T[node][1]) {
    T[node][0] += T[node][1];
    T[node * 2][1] += T[node][1];
    T[node * 2 + 1][1] += T[node][1];
  }
  T[node][1] = 0;
}
void update(int a, int b, int node) {
  refresh(a, b, node);
  if (a > hi || b < lo) return;
  if (a >= lo && b <= hi) {
    T[node][1] += VAL;
    refresh(a, b, node);
    return;
  }
  update(a, (a + b) / 2, node * 2);
  update((a + b) / 2 + 1, b, node * 2 + 1);
  T[node][0] = veci(T[node * 2][0], T[node * 2 + 1][0]);
}
long long query(int a, int b, int node) {
  refresh(a, b, node);
  if (a > hi || b < lo) return 0;
  if (a >= lo && b <= hi) return T[node][0];
  return veci(query(a, (a + b) / 2, node * 2),
              query((a + b) / 2 + 1, b, node * 2 + 1));
}
inline void solve() {
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    lo = i - 1;
    hi = i - 1;
    VAL = dp[i - 1];
    update(0, off - 1, 1);
    for (int j = 0; j < V[i].size(); j++) {
      int left = V[i][j].first;
      int pay = V[i][j].second;
      lo = 1;
      hi = left;
      VAL = pay;
      lo--;
      hi--;
      update(0, off - 1, 1);
    }
    lo = 1;
    hi = i;
    lo--;
    hi--;
    VAL = -cost[i];
    update(0, off - 1, 1);
    dp[i] = veci(dp[i], dp[i - 1]);
    lo = 1;
    hi = i;
    lo--;
    hi--;
    dp[i] = veci(dp[i], query(0, off - 1, 1));
    ans = veci(ans, dp[i]);
    dp[i] = veci(ans, dp[i]);
  }
  printf("%I64d\n", ans);
}
int main(void) {
  load();
  solve();
  return 0;
}
