#include <bits/stdc++.h>
using namespace std;
struct node {
  int64_t mx, lz;
  node() { mx = lz = 0; }
};
int n, m;
int inp[200005];
int64_t mem[200005];
vector<pair<int, int> > nums[200005];
node st[524288];
inline void push(int k, int lch, int rch) {
  st[lch].lz += st[k].lz;
  st[lch].mx += st[k].lz;
  st[rch].lz += st[k].lz;
  st[rch].mx += st[k].lz;
  st[k].lz = 0;
  st[k].mx = max(st[lch].mx, st[rch].mx);
}
int64_t query(int l, int r, int k, int stl, int str) {
  if (l > str || r < stl) return INT64_MIN;
  if (l <= stl && r >= str) return st[k].mx;
  int lch = k << 1;
  int rch = lch + 1;
  if (st[k].lz) push(k, lch, rch);
  int mid = (stl + str) >> 1;
  return max(query(l, r, lch, stl, mid), query(l, r, rch, mid + 1, str));
}
int64_t add(int l, int r, int k, int stl, int str, int64_t val) {
  if (l > str || r < stl) return st[k].mx;
  if (l <= stl && r >= str) {
    if (k < 262144) {
      st[k].lz += val;
    }
    st[k].mx += val;
    return st[k].mx;
  }
  int lch = k << 1;
  int rch = lch + 1;
  if (st[k].lz) push(k, lch, rch);
  int mid = (stl + str) >> 1;
  return st[k].mx = max(add(l, r, lch, stl, mid, val),
                        add(l, r, rch, mid + 1, str, val));
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &inp[i]);
  }
  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    nums[b].emplace_back(a, c);
  }
  int64_t mxd = 0;
  for (int i = 1; i <= n; i++) {
    mem[i] = mxd;
    add(1, i, 1, 0, 262144 - 1, -inp[i]);
    for (int j = nums[i].size() - 1; j >= 0; j--) {
      add(1, nums[i][j].first, 1, 0, 262144 - 1, nums[i][j].second);
    }
    mem[i] = mxd = max(mxd, query(1, i, 1, 0, 262144 - 1));
    add(i + 2, i + 2, 1, 0, 262144 - 1, mem[i]);
  }
  printf("%lld\n", mem[n]);
  return 0;
}
