#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, m;
int x[maxn], xx[maxn];
int main() {
  cout << setprecision(10) << fixed;
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  int res = m + n, x1, x2, y, cnt = 0;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) xx[cnt++] = x2;
  }
  sort(x, x + n);
  sort(xx, xx + cnt);
  m = cnt;
  x[n] = 1e9;
  int j = 0;
  for (int i = 0; i <= n; i++) {
    while (j < m && xx[j] < x[i]) j++;
    res = min(res, i + m - j);
  }
  cout << res;
  return 0;
}
