#include <bits/stdc++.h>
using namespace std;
long long v[100100];
long long h[100100];
int main() {
  long long n, m;
  cin >> n >> m;
  long long vidx = 0;
  for (; vidx < n; ++vidx) {
    long long x;
    cin >> x;
    v[vidx] = x;
  }
  long long hidx = 0;
  for (long long loop = 0; loop < m; ++loop) {
    long long x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 > 1) continue;
    h[hidx] = x2;
    ++hidx;
  }
  sort(v, v + vidx);
  sort(h, h + hidx);
  v[vidx] = 1e9;
  ++vidx;
  long long res = n + m;
  for (long long idx = 0; idx < vidx; ++idx) {
    long long lim = v[idx];
    auto it = lower_bound(h, h + hidx, lim) - h;
    res = min(res, hidx - it + idx);
  }
  cout << res;
  return 0;
}
