#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, m, a[maxn], b[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int x = 0;
  for (int i = 0; i < m; i++) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      b[x] = x2;
      x++;
    }
  }
  int ans = n + x - (lower_bound(b, b + x, 1e9) - b);
  sort(a, a + n);
  sort(b, b + x);
  for (int i = 0; i < n; i++) {
    int y = i + x - (lower_bound(b, b + x, a[i]) - b);
    ans = min(ans, y);
  }
  cout << ans;
  return 0;
}
