#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
long long cuts[500000 + 9];
int n, m;
vector<long long> comp;
int main() {
  cin >> n >> m;
  cuts[n] = 1000000000;
  for (int i = 0; i < n; i++) {
    cin >> cuts[i];
  }
  sort(cuts, cuts + n + 1);
  for (int i = 0; i < m; i++) {
    long long x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      comp.push_back(x2);
    }
  }
  sort(comp.begin(), comp.end());
  long long ans = 1e18;
  for (long long i = 0; i < n + 1; i++) {
    auto it = lower_bound(comp.begin(), comp.end(), cuts[i]);
    long long idx = distance(comp.begin(), it);
    long long cnt = (int)comp.size() - idx;
    ans = min(ans, i + cnt);
  }
  cout << ans;
  return 0;
}
