#include <bits/stdc++.h>
using namespace std;
bool comparer(pair<int, int> a, pair<int, int> b) {
  return a.second < b.second;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  a.push_back(1e9);
  sort(a.begin(), a.end());
  vector<int> zon(n + 2, 0);
  for (int i = 0; i < m; i++) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 != 1) continue;
    int to = upper_bound(a.begin(), a.end(), x2) - a.begin();
    zon[to]++;
  }
  for (int i = n + 1; i >= 1; i--) zon[i - 1] += zon[i];
  int answ = 1e9;
  for (int i = 1; i <= n + 1; i++) answ = min(answ, i - 1 + zon[i]);
  cout << answ;
  return 0;
}
