#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long w = 0, f = 1;
  char c = ' ';
  while (c < '0' || c > '9') c = getchar(), f = c == '-' ? -1 : f;
  while (c >= '0' && c <= '9') w = w * 10 + c - 48, c = getchar();
  return w * f;
}
struct node {
  long long l, r, y;
} b[100005];
long long n, m, a[100005];
signed main() {
  n = read(), m = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= m; i++) {
    b[i].l = read(), b[i].r = read(), b[i].y = read();
    if (b[i].l != 1) b[i].r = -1;
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1, [&](node x, node y) { return x.r < y.r; });
  b[m + 1].r = 1e10;
  a[n + 1] = 1e9;
  long long now = 1, ans = 1e10;
  for (long long i = 1; i <= n + 1; i++) {
    while (a[i] > b[now].r) now++;
    ans = min(ans, i + m - now);
  }
  printf("%lld\n", ans);
  return 0;
}
