#include <bits/stdc++.h>
using namespace std;
const int maxn = 101000;
int a[maxn], x, y, z, cnt, curr, ans, n, m;
vector<int> v;
int bs(int x) {
  int l = 0, r = m;
  while (l < r - 1) {
    int mid2 = (l + r) / 2;
    if (v[mid2] < x) {
      l = mid2;
    } else {
      r = mid2;
    }
  }
  if (v[l] >= x) {
    return -1;
  }
  return l;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int j = 0; j < m; ++j) {
    cin >> x >> y >> z;
    if (x == 1) {
      v.push_back(y);
      if (y == 1000000000) {
        ++cnt;
      }
    }
  }
  sort(a, a + n);
  sort(v.begin(), v.end());
  ans = cnt + n;
  if (!v.size()) {
    cout << 0 << endl;
    return 0;
  }
  v.push_back(1000001000);
  m = v.size();
  for (int i = 0; i < n; ++i) {
    curr = i;
    int val = bs(a[i]);
    curr += m - val - 2;
    ans = min(ans, curr);
  }
  cout << ans << endl;
}
