#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  int cols[n];
  for (int i = 0; i < n; i++) {
    cin >> cols[i];
  }
  sort(cols, cols + n);
  vector<int> just;
  int ex = 0;
  for (int i = 0; i < m; i++) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      if (x2 == 1000000000) {
        ex++;
      } else {
        just.push_back(x2);
      }
    }
  }
  sort(just.begin(), just.end());
  int ans = n;
  for (int i = 0; i < n; i++) {
    int val = just.end() - lower_bound(just.begin(), just.end(), cols[i]);
    ans = min(ans, i + val);
  }
  cout << ans + ex;
}
