#include <bits/stdc++.h>
#pragma GCC optimize("03")
using namespace std;
int n, m, a[100100], b[100100], x, y, z, st[100100], vf, mid, ans = INT_MAX;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= m; i++) {
    cin >> x >> y >> z;
    if (x == 1) b[++vf] = y;
  }
  int tot = n + m;
  int vert, oriz;
  vert = oriz = 0;
  sort(b + 1, b + vf + 1);
  if (b[vf] < a[1]) {
    return cout << 0, 0;
  }
  int p = 1;
  a[++n] = (int)1e9;
  for (int i = 1; i <= n + 1; i++) {
    while (p <= vf && b[p] < a[i]) {
      p++;
      oriz++;
    }
    ans = min(ans, (vf - p + 1) + i - 1);
  }
  cout << ans;
  return 0;
}
