#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int x[n], x1[m], x2[m], y[m];
  for (int i = 0; i < n; i++) cin >> x[i];
  sort(x, x + n);
  vector<int> v;
  for (int i = 0; i < m; i++) {
    cin >> x1[i] >> x2[i] >> y[i];
    if (x1[i] == 1) {
      v.push_back(x2[i]);
    }
  }
  sort(v.rbegin(), v.rend());
  if (v.size() == 0) {
    cout << "0";
    return 0;
  }
  int answer = 1000000000;
  for (int i = 0; i <= n; i++) {
    int right = 1000000000;
    if (i != n) right = x[i];
    if (v[0] < right)
      answer = min(answer, i);
    else {
      int l = 0;
      int r = (int)v.size() - 1;
      while (r - l > 1) {
        int sr = (r + l) / 2;
        if (v[sr] >= right)
          l = sr;
        else
          r = sr;
      }
      if (v[r] < right) r = l;
      answer = min(answer, i + r + 1);
    }
  }
  cout << answer;
  return 0;
}
