#include <bits/stdc++.h>
using namespace std;
map<long, long int> arvore;
long int soma(long x) {
  long int s = 0;
  while (x > 0) {
    s += arvore[x];
    x -= (x & -x);
  }
  return s;
}
void atualiza(long x) {
  while (x <= 1000000000L) {
    arvore[x] += 1;
    x += (x & -x);
  }
}
long int vet[100010];
int main() {
  long int n, m, t = 0;
  scanf("%ld %ld", &n, &m);
  for (int i = 0; i < n; i++) scanf("%ld", &vet[i]);
  sort(vet, vet + n);
  vet[n] = 0x3f3f3f3f;
  for (int i = 0; i < m; i++) {
    long int a, b, y;
    scanf("%ld %ld %ld", &a, &b, &y);
    if (a == 1) {
      atualiza(b);
      t++;
    }
  }
  long res = 0x3f3f3f3f;
  for (int i = 0; i <= n; i++) {
    res = min(res, t - soma(vet[i] - 1) + i);
  }
  printf("%ld\n", res);
  return 0;
}
