#include <bits/stdc++.h>
using namespace std;
int n, m;
int p[100001];
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m;
  vector<long long> v(n);
  vector<long long> h;
  int minival = -1;
  for (int i = 0; i < n; i++) cin >> v[i];
  long long e = 1000000000;
  v.push_back(e);
  int m1 = 0;
  for (int j = 0; j < m; j++) {
    long long a, b, c;
    cin >> a >> b >> c;
    if (a == 1) {
      h.push_back(b);
      m1++;
    }
  }
  m = m1;
  sort(v.begin(), v.end());
  sort(h.begin(), h.end());
  for (int i = 0; i <= n; i++) {
    p[i] = lower_bound(h.begin(), h.end(), v[i]) - h.begin();
    if (minival == -1)
      minival = i + m - p[i];
    else
      minival = min(minival, i + m - p[i]);
  }
  cout << minival << endl;
}
