#include <bits/stdc++.h>
using namespace std;
int n, m, sol;
vector<int> a, b;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  sol = n;
  sort(a.begin(), a.end());
  int x1, x2, y;
  for (int i = 0; i < m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      if (x2 == 1e9) {
        sol++;
      }
      b.push_back(x2);
    }
  }
  sort(b.begin(), b.end());
  int index = 0;
  for (int i = 0; i < n; i++) {
    while (index < (int)b.size() && b[index] < a[i]) {
      index++;
    }
    sol = min(sol, i + (int)b.size() - index);
  }
  cout << sol;
  return 0;
}
