#include <bits/stdc++.h>
using namespace std;
long long n, m, ans = 1e9, tmp;
long long v[100010];
vector<long long> h;
int main() {
  cin >> n >> m;
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
  }
  long long x1, x2, y;
  while (m--) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) h.push_back(x2);
  }
  sort(v, v + n);
  sort(h.begin(), h.end());
  vector<long long>::iterator it;
  for (long long i = 0; i < n; ++i) {
    tmp = i;
    it = lower_bound(h.begin(), h.end(), v[i]);
    tmp += h.size() - (it - h.begin());
    ans = min(ans, tmp);
  }
  it = lower_bound(h.begin(), h.end(), 1e9);
  ans = min(ans, n + (long long)h.size() - (it - h.begin()));
  cout << ans << endl;
  return 0;
}
