#include <bits/stdc++.h>
using namespace std;
void printArr(int a[], int n) {
  cout << "\n----Print Array start----\n";
  int i;
  for ((i) = 0; (i) < (n); (i)++) cout << a[i] << " ";
  cout << "\n----Print Array end----\n";
}
int main() {
  int n, m, i;
  cin >> n >> m;
  int v[n + 1], x1, x2, y;
  vector<int> h;
  for ((i) = 0; (i) < (n); (i)++) cin >> v[i];
  v[n] = 1e9;
  for ((i) = 0; (i) < (m); (i)++) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) h.push_back(x2);
  }
  sort(v, v + n);
  sort(h.begin(), h.end());
  int h_i = 0;
  while (h_i < h.size() && h[h_i] < v[0]) h_i++;
  int ans = h.size() - h_i;
  for (int v_i = 0; v_i < n; v_i++) {
    while (h_i < h.size() && h[h_i] < v[v_i + 1]) h_i++;
    int temp = h.size() - h_i + v_i + 1;
    ans = ((ans) < (temp) ? (ans) : (temp));
  }
  cout << ans;
  return 0;
}
