#include <bits/stdc++.h>
using namespace std;
long long n, i, j, ans = (long long)1E18, m;
vector<long long> v, h;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  long long x1, x2, y, x;
  for (i = 1; i <= n; i++) cin >> x, v.push_back(x);
  sort(v.begin(), v.end());
  v.push_back((long long)1E9);
  for (i = 1; i <= m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) h.push_back(x2);
  }
  sort(h.begin(), h.end());
  if (n == 0 and m == 0) return cout << 0, 0;
  if (m == 0) return cout << 0, 0;
  if (n == 0) {
    long long x = lower_bound(h.begin(), h.end(), (long long)1E9) - h.begin();
    x = (long long)h.size() - x;
    cout << x << endl;
    return 0;
  }
  for (i = 0; i < v.size(); i++) {
    long long x = lower_bound(h.begin(), h.end(), v[i]) - h.begin();
    ans = min(ans, i + (long long)h.size() - x);
  }
  cout << ans << endl;
}
