#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, ans = 0;
  cin >> n >> m;
  long long v[n];
  vector<long long> h;
  for (long long i = 0; i < n; i++) cin >> v[i];
  sort(v, v + n);
  long long x1, x2, y;
  for (long long i = 0; i < m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      if (x2 == 1000000000)
        ans++;
      else
        h.push_back(x2);
    }
  }
  sort(h.begin(), h.end());
  long long temp[n + 1];
  long long j = 0;
  for (long long i = 0; i < n; i++) {
    while (j < h.size() && v[i] > h[j]) j++;
    temp[i] = j;
  }
  long long tans = h.size();
  temp[n] = h.size();
  for (long long i = 0; i < n + 1; i++) {
    x1 = h.size() - temp[i];
    tans = min(tans, i + x1);
  }
  cout << ans + tans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
