#include <bits/stdc++.h>
using namespace std;
long long modpow(long long b, long long e, long long mod) {
  long long ans = 1;
  for (; e; b = b * b % mod, e /= 2)
    if (e & 1) ans = ans * b % mod;
  return ans;
}
template <class T>
struct lazy_seg {
 public:
  vector<T> st, lazy;
  lazy_seg(int n) { st.resize(4 * n + 1, 0), lazy.resize(4 * n + 1, 0); }
  lazy_seg() = default;
  void push(int l, int r, int curr) {
    if (lazy[curr] != 0) {
      st[curr] += lazy[curr];
      if (l != r)
        lazy[2 * curr] += lazy[curr], lazy[2 * curr + 1] += lazy[curr];
      lazy[curr] = 0;
    }
  }
  void pull(int l, int r, int curr) {
    push(l, r, curr);
    int mid = l + (r - l) / 2;
    if (l != r) push(l, mid, 2 * curr), push(mid + 1, r, 2 * curr + 1);
    st[curr] = max(st[2 * curr], st[2 * curr + 1]);
  }
  void upd(int x, int y, T v, int l, int r, int curr) {
    int mid = (l + r) / 2;
    push(l, r, curr);
    if (l == x && r == y) {
      lazy[curr] += v;
      push(l, r, curr);
      return;
    }
    if (y <= mid)
      upd(x, y, v, l, mid, 2 * curr);
    else if (x > mid)
      upd(x, y, v, mid + 1, r, 2 * curr + 1);
    else
      upd(x, mid, v, l, mid, 2 * curr),
          upd(mid + 1, y, v, mid + 1, r, 2 * curr + 1);
    pull(l, r, curr);
  }
  T qry(int x, int y, int l, int r, int curr) {
    int mid = (l + r) / 2;
    push(l, r, curr);
    if (l == x && r == y) return st[curr];
    if (y <= mid)
      return qry(x, y, l, mid, 2 * curr);
    else if (x > mid)
      return qry(x, y, mid + 1, r, 2 * curr + 1);
    return max(qry(x, mid, l, mid, 2 * curr),
               qry(mid + 1, y, mid + 1, r, 2 * curr + 1));
  }
};
const int N = 200005;
int n, m;
int c[N];
long long dp[N];
vector<pair<long long, long long> > f[N];
int32_t main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (int i = 0; i < m; i++) {
    int l, r, c;
    scanf("%d%d%d", &l, &r, &c);
    f[r].push_back({l, c});
  }
  lazy_seg<long long> seg(n);
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    seg.upd(1, i, -c[i], 1, n, 1);
    seg.upd(i, i, dp[i - 1], 1, n, 1);
    for (auto w : f[i]) {
      seg.upd(1, w.first, w.second, 1, n, 1);
    }
    dp[i] = max(seg.qry(1, n, 1, n, 1), dp[i]);
  }
  cout << dp[n] << endl;
}
