#include <bits/stdc++.h>
using namespace std;
const int MAX_INT = 1000 * 1000 * 1000;
int n, m;
vector<int> ver;
vector<int> hor;
int main() {
  cin >> n >> m;
  ver.reserve(n + 1);
  ver.resize(n);
  for (int i = 0; i < n; ++i) cin >> ver.at(i), ver.at(i) += 1;
  ver.push_back(MAX_INT + 1);
  sort(ver.begin(), ver.end());
  for (int i = 0; i < m; ++i) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) hor.push_back(x2 + 1);
  }
  sort(hor.begin(), hor.end());
  int bestAns = n + m;
  for (int i = 0; i < ver.size(); ++i) {
    auto it = lower_bound(hor.begin(), hor.end(), ver.at(i));
    int mustBreak = distance(it, hor.end());
    bestAns = min(bestAns, i + mustBreak);
  }
  cout << bestAns << endl;
}
