#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, m;
  cin >> n >> m;
  vector<long long> v, h;
  for (long long idx = 0; idx < n; ++idx) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  for (long long idx = 0; idx < m; ++idx) {
    long long x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 > 1) continue;
    h.push_back(x2);
  }
  sort(v.begin(), v.end());
  sort(h.begin(), h.end());
  long long res = n + m;
  for (long long idx = 0; idx <= v.size(); ++idx) {
    long long lim = idx == v.size() ? 1000000000 : v[idx];
    auto it = lower_bound(h.begin(), h.end(), lim);
    res = min(res, distance(it, h.end()) + idx);
  }
  cout << res;
  return 0;
}
