#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int vertical[MAXN];
struct interval {
  int s, t, y;
} horiziontal[MAXN];
bool operator<(interval a, interval b) {
  return a.t < b.t || (a.t == b.t && a.y < b.y);
}
bool operator==(interval a, interval b) { return a.t == b.t; }
int main(void) {
  int n, m, x1, x2, y;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &vertical[i]);
  vertical[n] = 1000000000;
  sort(vertical, vertical + n);
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &x1, &x2, &y);
    if (x1 > 1) continue;
    horiziontal[cnt] = (interval){x1, x2, y};
    ++cnt;
  }
  sort(horiziontal, horiziontal + cnt);
  int answer = 0x3f3f3f3f;
  for (int i = 0; i <= n; i++) {
    int pos = lower_bound(horiziontal, horiziontal + cnt,
                          (interval){0, vertical[i], 0}) -
              horiziontal;
    int step = cnt - (pos + 1) + 1;
    answer = min(answer, step + i);
  }
  printf("%d\n", answer);
  return 0;
}
