#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int ddx[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
bool debug = false;
bool comp(pair<long long, pair<long long, int> > a,
          pair<long long, pair<long long, int> > b) {
  return (a.first + a.second.first < b.first + b.second.first);
}
int main() {
  int N, M;
  long long sum = 0;
  cin >> N >> M;
  vector<int> X(N), A(M), B(M), Y(M);
  for (int i = 0; i < N; i++) cin >> X[i], sum += X[i];
  int ans = 0;
  for (int i = 0; i < M; i++) {
    cin >> A[i] >> B[i] >> Y[i];
    if (sum < Y[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}
