#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long vertical[n + 1];
  for (long long i = 0; i < n; i++) {
    cin >> vertical[i];
  }
  vertical[n] = 1e9;
  sort(vertical, vertical + n + 1);
  vector<long long> hor;
  for (long long i = 0; i < m; i++) {
    long long x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      hor.push_back(x2);
    }
  }
  sort(hor.begin(), hor.end());
  long long ans = 1e18;
  for (long long i = 0; i <= n; i++) {
    long long x = i;
    x += hor.end() - lower_bound(hor.begin(), hor.end(), vertical[i]);
    ans = min(ans, x);
  }
  cout << ans;
}
