#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, ans = 535535535535, a, b, c, idx, x, z, sz,
                     nm = 1000000000;
  vector<long long> u, v;
  vector<long long>::iterator it;
  scanf("%lld %lld", &m, &n);
  for (i = 0; i < m; i++) {
    scanf("%lld", &a);
    u.push_back(a);
  }
  u.push_back(nm);
  sort(u.begin(), u.end());
  for (i = 0; i < n; i++) {
    scanf("%lld %lld %lld", &a, &b, &c);
    if (a == 1) v.push_back(b);
  }
  sort(v.begin(), v.end());
  sz = v.size();
  for (i = 0; i < m + 1; i++) {
    idx = lower_bound(v.begin(), v.end(), u[i]) - v.begin();
    z = i + (sz - idx);
    ans = min(z, ans);
  }
  printf("%lld\n", ans);
  return 0;
}
