#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int vert[MAXN];
int cnt[MAXN];
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, m, x1, x2, y;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> vert[i];
  }
  sort(vert, vert + n);
  vert[n] = 1000000000;
  n++;
  for (int i = 0; i < m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 != 1) continue;
    int pos = upper_bound(vert, vert + n, x2) - vert;
    pos--;
    if (pos < 0) continue;
    cnt[pos]++;
  }
  for (int i = m - 1; i >= 0; i--) {
    cnt[i] = cnt[i] + cnt[i + 1];
  }
  int ans = vert[n - 1];
  for (int i = 0; i < n; i++) {
    ans = min(ans, i + cnt[i]);
  }
  cout << ans << '\n';
}
