#include <bits/stdc++.h>
using namespace std;
int bsearch_less_or_eq(vector<int> &vh, int val) {
  int left = 0, right = vh.size() - 1, middle;
  int index = -1;
  while (left <= right) {
    middle = left + (right - left) / 2;
    if (vh[middle] <= val) {
      index = middle;
      left = middle + 1;
    } else
      right = middle - 1;
  }
  return index;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> xv(n), xh;
  for (int i = 0; i < n; i++) {
    cin >> xv[i];
  }
  int a, b, c;
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> c;
    if (a == 1) xh.push_back(b);
  }
  xv.push_back(1000000000);
  sort(xv.begin(), xv.end());
  sort(xh.begin(), xh.end());
  int min = xh.size(), curr_range, ignored_horizontals;
  m = xh.size();
  for (int i = 0; i < xv.size(); i++) {
    curr_range = xv[i] - 1;
    ignored_horizontals = bsearch_less_or_eq(xh, curr_range);
    if (i + m - (ignored_horizontals + 1) < min)
      min = i + m - (ignored_horizontals + 1);
  }
  cout << min;
  return 0;
}
