#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 19;
int A[N], B[N], tot;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &A[i]);
  A[0] = 1;
  A[++n] = 1e9;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d%d%*d", &x, &y);
    if (x != 1)
      continue;
    else
      B[++tot] = y;
  }
  sort(A, A + n + 1);
  sort(B + 1, B + tot + 1);
  int now = 0, ans = 1e9;
  for (int i = 0; i < n; ++i) {
    while (now <= tot && B[now] < A[i + 1]) ++now;
    if ((now && B[now] >= A[i + 1]) || now > tot) --now;
    ans = min(ans, tot - now + i);
  }
  printf("%d\n", ans);
  return 0;
}
