#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> ver, hor;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ver.push_back(x);
  }
  for (int i = 0; i < m; ++i) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) hor.push_back(x2);
  }
  sort(ver.begin(), ver.end());
  sort(hor.begin(), hor.end());
  int j = 0;
  int ans = INT_MAX;
  for (int i = 0; i <= ver.size(); ++i) {
    int right;
    if (i < ver.size())
      right = ver[i];
    else
      right = 1e9;
    while (j < hor.size() and hor[j] < right) j++;
    ans = min(ans, int(i + (hor.size()) - j));
  }
  cout << ans;
  return 0;
}
