#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
long long powmod(long long a, long long b, long long MOD) {
  long long ans = 1;
  while (b) {
    if (b % 2) ans = ans * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return ans;
}
const int maxn = 3e5 + 232;
int n, m, a[maxn], b[maxn], cnt;
int l, r, h;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  int ans = n + m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= m; i++) {
    cin >> l >> r >> h;
    if (l == 1) b[++cnt] = r;
  }
  sort(b + 1, b + 1 + cnt);
  a[n + 1] = 1000000000;
  for (int i = 1; i <= n + 1; i++) {
    int p = lower_bound(b + 1, b + 1 + cnt, a[i]) - b;
    ans = min(ans, cnt - p + 1 + i - 1);
  }
  cout << ans << endl;
  return 0;
}
