#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  int ver[n + 1];
  ver[n] = 1e9;
  for (int i = 0; i < n; i++) cin >> ver[i];
  int hor[m];
  for (int i = 0; i < m; i++) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 > 1)
      hor[i] = 0;
    else
      hor[i] = x2;
  }
  if (m == 0) {
    cout << 0 << endl;
    return 0;
  }
  sort(ver, ver + n);
  sort(hor, hor + m);
  int wy = 10000000;
  int poz = m;
  int a = 0;
  for (int i = 0; i < n + 1; i++) {
    while (a < m and hor[a] < ver[i]) {
      poz--;
      a++;
    }
    wy = min(wy, poz + i);
  }
  cout << wy << endl;
  return 0;
}
