#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using pll = pair<ll, ll>;
using vi = vector<ll>;
using vpii = vector<pii>;
using vl = vector<ll>;
using ld = long double;
using vs = vector<string>;
ll N, M;
vi xx;
vi ww;
void add(ll x) {
  while (!ww.empty() && ww.back() < x) ww.pop_back();
}
void solve() {
  cin >> N >> M;
  xx.resize(N);
  for (auto &x : xx) cin >> x;
  for (ll i = 0; i < M; i++) {
    ll x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 > 1) continue;
    ww.push_back(x2);
  }
  sort((ww).begin(), (ww).end());
  reverse((ww).begin(), (ww).end());
  ll ans = M + N;
  xx.push_back((ll)1e9);
  sort((xx).begin(), (xx).end());
  reverse((xx).begin(), (xx).end());
  ll rem = 0;
  while (!xx.empty()) {
    ll x = xx.back();
    xx.pop_back();
    add(x);
    ll val = ww.size() + rem;
    ans = min(ans, val);
    rem++;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
