#include <bits/stdc++.h>
using namespace std;
const int maxn = 200100;
long long dp[maxn], n, m;
long long arr[maxn];
vector<pair<long long, long long> > intervals[maxn];
long long value[maxn];
long long tree[4 * maxn];
long long lazy[4 * maxn];
void push_update(int li, int ri, int index) {
  if (lazy[index] != 0) {
    tree[index] += lazy[index];
    if (li != ri) {
      lazy[2 * index] += lazy[index];
      lazy[2 * index + 1] += lazy[index];
    }
    lazy[index] = 0;
  }
}
void update(int ul, int ur, long long uval, int li = 0, int ri = n,
            int index = 1) {
  push_update(li, ri, index);
  if (li > ur || ri < ul)
    return;
  else if (li >= ul && ri <= ur) {
    lazy[index] += uval;
    push_update(li, ri, index);
  } else {
    int mid = (li + ri) / 2;
    update(ul, ur, uval, li, mid, 2 * index);
    update(ul, ur, uval, mid + 1, ri, 2 * index + 1);
    tree[index] = max(tree[2 * index], tree[2 * index + 1]);
  }
}
long long query(int ql, int qr, int li = 0, int ri = n, int index = 1) {
  push_update(li, ri, index);
  if (li > qr || ri < ql)
    return 0;
  else if (li >= ql && ri <= qr)
    return tree[index];
  else {
    int mid = (li + ri) / 2;
    long long a = query(ql, qr, li, mid, 2 * index);
    long long b = query(ql, qr, mid + 1, ri, 2 * index + 1);
    tree[index] = max(tree[2 * index], tree[2 * index + 1]);
    return max(a, b);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  long long l, r, p;
  for (int i = 1; i <= m; i++) {
    cin >> l >> r >> p;
    intervals[r].push_back(make_pair(l, p));
  }
  long long result = 0LL;
  long long sum = 0LL;
  for (int i = 1; i <= n; i++) {
    for (auto j : intervals[i]) {
      update(0, j.first, j.second);
      value[j.first] += j.second;
    }
    sum += arr[i];
    dp[i] = max(0LL, dp[i - 1]);
    dp[i] = max(dp[i], dp[i - 1] + value[i] - arr[i]);
    dp[i] = max(dp[i], query(0, i) - sum);
    update(i, i, dp[i - 1] + (sum - arr[i]));
    result = max(result, dp[i]);
  }
  cout << result << "\n";
  return 0;
}
