#include <bits/stdc++.h>
using namespace std;
int n, m, vertical[100005], orizontal[100005], a, b, c, nr, sol;
int main() {
  int i;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> vertical[i];
  }
  for (i = 1; i <= m; i++) {
    cin >> a >> b >> c;
    if (a == 1) {
      nr++;
      orizontal[nr] = b;
    }
  }
  sort(vertical + 1, vertical + n + 1);
  sort(orizontal + 1, orizontal + nr + 1);
  vertical[n + 1] = 1e9;
  sol = n + m;
  for (i = 0; i <= n; i++) {
    int val = vertical[i + 1];
    if (orizontal[nr] < val) {
      sol = min(sol, i);
    } else {
      int st, dr, mid, poz;
      st = 1;
      dr = nr;
      while (st <= dr) {
        mid = (st + dr) / 2;
        if (orizontal[mid] >= val) {
          poz = mid;
          dr = mid - 1;
        } else {
          st = mid + 1;
        }
      }
      sol = min(sol, i + nr - poz + 1);
    }
  }
  cout << sol;
  return 0;
}
