#include <bits/stdc++.h>
using namespace std;
int n, m;
long long cost[200009], dp[200009], tree[4 * 200009], mark[4 * 200009],
    sum[200009];
inline void pushup(int rt) { tree[rt] = max(tree[rt << 1], tree[rt << 1 | 1]); }
inline void pushdown(int rt) {
  if (mark[rt]) {
    tree[rt << 1] += mark[rt];
    mark[rt << 1] += mark[rt];
    tree[rt << 1 | 1] += mark[rt];
    mark[rt << 1 | 1] += mark[rt];
  }
  mark[rt] = 0;
}
void update(int L, int R, long long x, int l, int r, int rt) {
  if (L <= l && r <= R) {
    tree[rt] += x;
    mark[rt] += x;
    return;
  }
  pushdown(rt);
  int m = (l + r) >> 1;
  if (L <= m) update(L, R, x, l, m, rt << 1);
  if (R > m) update(L, R, x, m + 1, r, rt << 1 | 1);
  pushup(rt);
}
vector<pair<int, int> > G[200009];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    sum[i] = sum[i - 1] + x;
  }
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    G[y].push_back(make_pair(x, z));
  }
  dp[0] = 0;
  update(0, 0, 0, 0, n, 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < (int)G[i].size(); j++) {
      update(0, G[i][j].first - 1, G[i][j].second, 0, n, 1);
    }
    dp[i] = max(dp[i - 1], tree[1] - sum[i]);
    update(i, i, dp[i] + sum[i], 0, n, 1);
  }
  cout << dp[n] << endl;
  return 0;
}
