#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5, INF = 1e9;
int N, M, C, Z, H, P;
int A[MAXN];
int B[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> M;
  H = N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> P;
    if (P == 1) {
      cin >> B[Z] >> P;
      if (B[Z] == INF) {
        H++;
      }
      Z++;
    } else {
      cin >> P >> P;
    }
  }
  sort(A, A + N);
  sort(B, B + Z);
  for (int i = 0; i < N; i++) {
    while (C < Z) {
      if (B[C] >= A[i]) {
        break;
      }
      C++;
    }
    H = min(H, i + Z - C);
  }
  cout << H << '\n';
  return 0;
}
