#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
int main() {
  int n, m, x, y, ans;
  cin >> n >> m;
  vector<int> v, w;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  for (int i = 0; i < m; i++) {
    int x1;
    cin >> x1 >> x >> y;
    if (x1 != 1) continue;
    w.push_back(x);
  }
  sort(v.begin(), v.end());
  sort(w.begin(), w.end());
  m = w.size();
  int j = 0, i = 0;
  while (j < m && w[j] != 1000000007 - 7 && (v.size() == 0 || w[j] < v[0])) j++;
  ans = m - j;
  for (int i = 0; i < n - 1; i++) {
    while (j < m && w[j] < v[i + 1]) j++;
    ans = min(ans, i + 1 + m - j);
  }
  while (j < m && w[j] < 1000000007 - 7) j++;
  ans = min(ans, m - j + n);
  cout << ans;
  return 0;
}
