#include <bits/stdc++.h>
using namespace std;
int a[200010], t[200010], l[200010], r[200010];
vector<int> v, vv;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, x, xx, y;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  a[n] = 1000000000;
  vector<int> v;
  for (int i = 0; i < m; i++) {
    cin >> x >> xx >> y;
    l[i] = x;
    r[i] = xx;
    if (x == 1) {
      v.push_back(xx);
    }
  }
  sort(v.begin(), v.end());
  int ans = INT_MAX;
  for (int i = 0; i <= n; i++) {
    auto it = lower_bound(v.begin(), v.end(), a[i]) - v.begin();
    int tot = v.size() - it;
    ans = min(ans, i + tot);
  }
  cout << ans;
  return 0;
}
