#include <bits/stdc++.h>
using namespace std;
int pionowe[100007];
int poz[100007];
int main() {
  ios_base::sync_with_stdio(0);
  int a, b, maksi = 1000000009, il = 0, c, d, akt = 0, e, f = 0;
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    cin >> pionowe[i];
  }
  for (int i = 0; i < b; i++) {
    cin >> c >> d >> e;
    if (c == 1 && d < 1000000000) {
      poz[il] = d;
      il++;
    }
    if (c == 1 && d == 1000000000) {
      f++;
    }
  }
  maksi = 1000000000;
  sort(pionowe, pionowe + a);
  sort(poz, poz + il);
  pionowe[a] = 1000000000;
  for (int i = 0; i <= a; i++) {
    while (poz[akt] < pionowe[i] && akt < il) {
      akt++;
    }
    maksi = min(il - akt + i + f, maksi);
  }
  cout << maksi;
  return 0;
}
