#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 5e5 + 10;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v1(n);
  for (auto& x : v1) cin >> x;
  vector<int> v2;
  while (m--) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 != 1) continue;
    v2.push_back(x2);
  }
  v1.push_back(int(1e9));
  n++;
  sort(v1.rbegin(), v1.rend());
  sort(v2.rbegin(), v2.rend());
  int ans = INF;
  while (!v1.empty()) {
    while (!v2.empty() && v2.back() < v1.back()) v2.pop_back();
    ans = min(ans, int(n - v1.size()) + (int)v2.size());
    v1.pop_back();
  }
  printf("%d\n", ans);
  return 0;
}
