#include <bits/stdc++.h>
using namespace std;
vector<int> pion;
vector<int> poziom;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int x1, x2, y;
  for (int i = 0; i < n; i++) {
    cin >> x1;
    pion.push_back(x1);
  }
  sort(pion.begin(), pion.end());
  for (int i = 0; i < m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 != 1) continue;
    poziom.push_back(x2);
  }
  sort(poziom.begin(), poziom.end());
  if (poziom.size() == 0) {
    cout << "0\n";
    return 0;
  }
  int wynik = 10000000, l = -1;
  pion.push_back(1000000000);
  for (int i = 0; i < (int)pion.size(); i++) {
    while (((l + 1) < (int)poziom.size()) && (poziom[l + 1] < pion[i])) {
      l++;
    }
    wynik = min(wynik, (i + (int)poziom.size() - l - 1));
  }
  cout << wynik << "\n";
  return 0;
}
