#include <bits/stdc++.h>
int n, m, q, ans, xa, xb, y;
int a[100010], b[100010];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  a[++n] = 1e9;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &xa, &xb, &y);
    if (xa == 1) b[++q] = xb;
  }
  std::sort(a + 1, a + n + 1);
  std::sort(b + 1, b + q + 1);
  ans = 1e9;
  for (int i = 1, j = 1; i <= n; i++) {
    for (; j <= q && b[j] < a[i]; j++)
      ;
    ans = std::min(ans, q - j + i);
  }
  printf("%d\n", ans);
}
