#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double PI = 3.14159265359;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, base = 0;
  cin >> n >> m;
  vector<int> h, v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  for (int i = 0; i < m; i++) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      if (x2 == 1e9)
        base++;
      else
        h.push_back(x2);
    }
  }
  if (!n) {
    cout << base;
    return 0;
  }
  sort(h.begin(), h.end());
  sort(v.begin(), v.end());
  int hsz = h.size();
  vector<int> rem(n + 1);
  int r = 0;
  for (int i = 0; i < n; i++) {
    while (r < hsz && h[r] < v[i]) {
      r++;
    }
    rem[i] = hsz - r;
  }
  int ans = MOD;
  for (int i = 0; i <= n; i++) {
    ans = min(ans, base + i + rem[i]);
  }
  cout << ans;
  return 0;
}
