#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vpii = vector<pair<int, int> >;
using vpll = vector<pair<long long, long long> >;
using vld = vector<long double>;
using vb = vector<bool>;
const int inf = (int)1e9 + 7;
const long long llinf = (long long)1e18 + 7;
void solve() {
  long long n, m;
  cin >> n >> m;
  long long v[n];
  map<long long, long long> mpp;
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v, v + n);
  long long c1 = 0;
  for (long long i = 0; i < m; i++) {
    long long x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 != 1) continue;
    c1++;
    mpp[x1]++;
    mpp[x2 + 1]--;
  }
  if (c1 == 0) {
    cout << 0 << "\n";
    return;
  }
  long long ans = llinf, cnt = 0ll;
  for (auto i : mpp) {
    long long id = i.first;
    long long c = i.second;
    if (id > 1000000000) {
      break;
    }
    cnt += c;
    ans = min(ans, cnt + (lower_bound(v, v + n, id) - v));
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int ttt = 1;
  while (ttt--) {
    solve();
  }
}
