#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> x2;
  vector<long long> x(n + 1);
  for (long long i = 0; i < n; ++i) {
    cin >> x[i];
  }
  x[n] = 1e9;
  for (long long i = 0; i < m; ++i) {
    long long l, r, y;
    cin >> l >> r >> y;
    if (l != 1) continue;
    x2.push_back(r);
  }
  sort(x.begin(), x.end());
  sort(x2.begin(), x2.end());
  long long h = x2.size(), minm = h;
  for (long long i = 0; i < n + 1; ++i) {
    long long rem = i + x2.end() - lower_bound(x2.begin(), x2.end(), x[i]);
    minm = min(rem, minm);
  }
  cout << minm;
}
