#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
long long dp[maxn];
int n, m;
struct node {
  int lb, lu;
  long long w;
};
vector<node> ve[maxn];
int lb, lu;
long long w, cost[maxn];
struct seg {
  long long ma, lazy;
} tr[maxn << 2];
void build(int o, int l, int r) {
  tr[o].ma = 0;
  tr[o].lazy = 0;
  if (l == r) {
    return;
  }
  int mid = (l + r) >> 1;
  build(o << 1, l, mid);
  build(o << 1 | 1, mid + 1, r);
}
void pushup(int o) { tr[o].ma = max(tr[o << 1].ma, tr[o << 1 | 1].ma); }
void pushdown(int o) {
  if (tr[o].lazy) {
    tr[o << 1].ma += tr[o].lazy;
    tr[o << 1 | 1].ma += tr[o].lazy;
    tr[o << 1].lazy += tr[o].lazy;
    tr[o << 1 | 1].lazy += tr[o].lazy;
    tr[o].lazy = 0;
  }
}
void update(int o, int l, int r, int ql, int qr, long long val) {
  if (ql <= l && qr >= r) {
    tr[o].ma += val;
    tr[o].lazy += val;
    return;
  }
  pushdown(o);
  int mid = (l + r) >> 1;
  if (ql <= mid) update(o << 1, l, mid, ql, qr, val);
  if (qr > mid) update(o << 1 | 1, mid + 1, r, ql, qr, val);
  pushup(o);
}
long long query(int o, int l, int r, int ql, int qr) {
  if (ql <= l && qr >= r) {
    return tr[o].ma;
  }
  pushdown(o);
  int mid = (l + r) >> 1;
  long long maxx = 0;
  if (ql <= mid) maxx = max(maxx, query(o << 1, l, mid, ql, qr));
  if (qr > mid) maxx = max(maxx, query(o << 1 | 1, mid + 1, r, ql, qr));
  return maxx;
}
int main() {
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &cost[i]);
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d%d%lld", &lb, &lu, &w);
      ve[lu].push_back({lb, lu, w});
    }
    build(1, 0, n + 1);
    long long maxx = 0;
    for (int i = 1; i <= n + 1; i++) {
      dp[i] = dp[i - 1];
      update(1, 0, n + 1, 0, i - 1, -cost[i]);
      for (int j = 0; j < ve[i].size(); j++) {
        lb = ve[i][j].lb, w = ve[i][j].w;
        update(1, 0, n + 1, 0, lb - 1, w);
      }
      dp[i] = max(dp[i], query(1, 0, n + 1, 0, i - 1));
      update(1, 0, n + 1, i, i, dp[i]);
      maxx = max(maxx, dp[i]);
    }
    printf("%lld\n", maxx);
  }
}
