#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-O2")
template <class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T> >;
const int lim = 1e5 + 5;
long long n, m, x[lim], x1, x2, y, c, ans = 1e9;
vector<long long> v;
stack<long long> st;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
  }
  sort(x + 1, x + n + 1);
  for (int i = 1; i <= m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      v.push_back(x2);
      c++;
    }
  }
  sort(v.begin(), v.end(), greater<long long>());
  for (long long u : v) {
    st.push(u);
  }
  x[n + 1] = 1e9;
  for (int i = 1; i <= n + 1; i++) {
    while (!st.empty() && st.top() < x[i]) {
      st.pop();
      c--;
    }
    ans = min(ans, c + i - 1);
  }
  cout << ans << endl;
  return 0;
}
