#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  vector<int> vert(N);
  for (int i = 0, _n = (N); i < _n; ++i) cin >> vert[i];
  vert.push_back(INF);
  vector<int> horiz;
  for (int j = 0, _n = (M); j < _n; ++j) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) horiz.push_back(x2);
  }
  sort(vert.begin(), vert.end());
  sort(horiz.begin(), horiz.end());
  int best = N + M;
  for (int n = 0, j = 0; n <= N; ++n) {
    while (j < int((horiz).size()) && horiz[j] < vert[n]) ++j;
    int cur = n + int((horiz).size()) - j;
    best = min(best, cur);
  }
  cout << best << '\n';
  return 0;
}
