#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
const int mod = 1e9 + 7;
int add(int a, int b) {
  int res = (a + b) % mod;
  return (res < 0) ? res + mod : res;
}
int mul(int a, int b) {
  int res = (a * 1LL * b) % mod;
  return (res < 0) ? res + mod : res;
}
int n, m;
int v[N];
vector<int> h;
int l, r, y;
signed main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < m; i++) {
    cin >> l >> r >> y;
    if (l == 1) h.push_back(r);
  }
  v[n] = 1000000000;
  sort(v, v + n);
  sort(h.begin(), h.end(), greater<int>());
  int ans = h.size();
  for (int i = 0; i <= n; i++) {
    while (!h.empty() && h.back() < v[i]) h.pop_back();
    ans = min(ans, (int)h.size() + i);
  }
  cout << ans;
  return 0;
}
