#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  while (b != 0) {
    if (b & 1) {
      res *= a;
    }
    a = (a * a);
    b = (b / 2);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, m, y, x1, x2, ans = 1000000000;
  vector<long long> V, H;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> x1;
    V.push_back(x1);
  }
  for (long long i = 0; i < m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      H.push_back(x2);
    }
  }
  V.push_back(1000000000);
  V.push_back(0);
  vector<long long>::iterator it;
  sort(V.begin(), V.end());
  sort(H.begin(), H.end());
  long long n1 = H.size();
  for (long long i = 0; i <= n; i++) {
    long long deletions = i;
    long long a = V[i + 1];
    it = lower_bound(H.begin(), H.end(), a);
    if (it == H.end()) {
      ans = min(ans, deletions);
      continue;
    }
    long long idx = it - H.begin();
    deletions += (n1 - idx);
    ans = min(ans, deletions);
  }
  cout << ans;
  return 0;
}
