#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> ver(n);
  for (int i = 0; i < n; ++i) cin >> ver[i];
  ver.push_back((int)1e9);
  sort(ver.begin(), ver.end());
  vector<int> q(n + 1, 0);
  int x1, x2, y;
  vector<int> v;
  for (int i = 0; i < m; ++i) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) v.push_back(x2);
  }
  sort(v.rbegin(), v.rend());
  int ct = 0;
  for (int i = n; i >= 0; --i) {
    while (ct < v.size() and ver[i] <= v[ct]) ++ct;
    q[i] = ct;
  }
  int res = 1e9;
  for (int i = 0; i <= n; ++i) {
    res = min(res, i + q[i]);
  }
  cout << res << '\n';
}
