#include <bits/stdc++.h>
using namespace std;
const int maxn = 200 * 1000 + 10;
const long long INF = 1000000000000000000;
int n, m, x, y, p, zero, tmp;
long long mx[4 * maxn], data[4 * maxn], dp[maxn], pay[maxn], kmk;
vector<pair<int, long long> > race[maxn];
void push(int x, int &l, int &r) {
  int mid = (l + r) / 2;
  mx[2 * x + 1] += data[x];
  mx[2 * x + 2] += data[x];
  data[2 * x + 1] += data[x];
  data[2 * x + 2] += data[x];
  data[x] = 0;
}
void add(int x, int &l, int &r, int &ql, int &qr, long long &val) {
  if (l >= qr || ql >= r) return;
  if (ql <= l && r <= qr) {
    data[x] += val;
    mx[x] += val;
    return;
  }
  int mid = (l + r) / 2;
  push(x, l, r);
  add(2 * x + 1, l, mid, ql, qr, val);
  add(2 * x + 2, mid, r, ql, qr, val);
  mx[x] = max(mx[2 * x + 1], mx[2 * x + 2]);
}
long long req(int x, int &l, int &r, int &ql, int &qr) {
  if (l >= qr || ql >= r) return -INF;
  if (ql <= l && r <= qr) return mx[x];
  int mid = (l + r) / 2;
  push(x, l, r);
  return max(req(2 * x + 1, l, mid, ql, qr), req(2 * x + 2, mid, r, ql, qr));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> pay[i];
    pay[i] = -pay[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> p;
    x--;
    y--;
    race[y].push_back(make_pair(x, p));
  }
  for (int i = 0; i < n; i++) {
    tmp = i + 1;
    add(zero, zero, n, zero, i, pay[i]);
    kmk += pay[i];
    for (int j = 0; j < ((int(race[i].size()))); j++) {
      add(zero, zero, n, zero, race[i][j].first, race[i][j].second);
      kmk += race[i][j].second;
    }
    if (i > 1) add(zero, zero, n, i, tmp, dp[i - 1]);
    dp[i] = max(kmk, req(zero, zero, n, zero, tmp));
  }
  cout << dp[n - 1];
  return 0;
}
