#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vi1, vi2;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    vi1.push_back(x);
  }
  sort(vi1.begin(), vi1.end());
  vi1.push_back(1e9);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == 1) vi2.push_back(b);
  }
  sort(vi2.begin(), vi2.end());
  int j = 0, mini = vi2.size();
  for (int i = 0; i <= n; i++) {
    int hi = vi1[i];
    while (j < vi2.size() && vi2[j] < hi) {
      j++;
    }
    int asdf = vi2.size();
    mini = min(mini, i + asdf - j);
  }
  cout << mini;
  return 0;
}
