#include <bits/stdc++.h>
using namespace std;
const int N = 100004;
int n, m, a[N], b[N], p = 0, INF = 1000000000;
int main() {
  int ans = INF, u, v, w;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  a[n++] = INF;
  sort(a, a + n);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &u, &v, &w);
    if (u == 1) b[p++] = v;
  }
  sort(b, b + p);
  for (int i = 0; i < n; i++) {
    int pos = lower_bound(b, b + p, a[i]) - b;
    ans = min(ans, i + p - pos);
  }
  printf("%d\n", ans);
}
