#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> v(n), h;
  for (auto &t : v) scanf("%d", &t);
  for (int i = 0; i < m; i++) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) h.push_back(x2);
  }
  v.push_back(1000000000);
  sort(v.begin(), v.end());
  sort(h.begin(), h.end());
  int ans = n + m;
  for (int i = 0, j = 0; i <= n; i++) {
    while (j < h.size() && h[j] < v[i]) j++;
    ans = min(ans, i + (int)h.size() - j);
  }
  printf("%d\n", ans);
  return 0;
}
