#include <bits/stdc++.h>
using namespace std;
void solve() {
  vector<long long> s;
  long long n, m;
  cin >> n >> m;
  long long temp;
  for (long long i = 0; i < n; i++) {
    cin >> temp;
    s.push_back(temp);
  }
  sort(s.begin(), s.end());
  if (n == 0 or s[n - 1] < 1000000000) s.push_back(1000000000);
  vector<long long> v;
  long long ans = 1000000000;
  long long x, y, r;
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> r;
    if (x == 1) {
      v.push_back(y);
    }
  }
  sort(v.begin(), v.end());
  long long tint = 0;
  long long sz = v.size();
  for (int i = 0; i < s.size(); i++) {
    for (; tint < sz and v[tint] < s[i]; tint++) {
    }
    ans = min(ans, sz - tint + i);
  }
  cout << ans;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int tc;
  tc = 1;
  while (tc--) {
    solve();
    if (tc) cout << "\n";
  }
  return 0;
}
