#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(false);
  int n, m;
  std::cin >> n >> m;
  std::vector<int> v;
  v.resize(n);
  for (long long i = 0; i < n; i++) {
    std::cin >> v[i];
  }
  std::vector<int> h;
  v.reserve(m);
  int x1, x2, y;
  for (long long i = 0; i < m; i++) {
    std::cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      h.push_back(x2);
    }
  }
  v.push_back(1000000000);
  std::sort(v.begin(), v.end(), std::greater<int>());
  std::sort(h.begin(), h.end(), std::greater<int>());
  std::vector<int> vc;
  vc.resize(n + 1);
  int hi = 0;
  for (int i = 0; i <= n; i++) {
    while (hi < h.size() && h[hi] >= v[i]) hi++;
    vc[n - i] = hi;
  }
  long long min = LONG_MAX;
  for (long long i = 0; i <= n; i++) {
    min = std::min(min, i + vc[i]);
  }
  std::cout << min;
  return 0;
}
