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