#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (int i = 0; i < n; i += 1) cin >> v[i];
  map<int, vector<pair<int, int>>> h;
  for (int i = 0; i < m; i += 1) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    h[y].push_back({x1, x2});
  }
  vector<int> pos;
  for (auto &pr : h) {
    sort(pr.second.begin(), pr.second.end());
    int priv = 0;
    for (auto p : pr.second) {
      if (p.first == priv + 1)
        priv = p.second;
      else
        break;
    }
    pos.push_back(priv);
  }
  sort(v.begin(), v.end());
  sort(pos.begin(), pos.end());
  int ans = n + m;
  v.push_back(1e9);
  for (int i = 0; i < n + 1; i += 1) {
    int p = lower_bound(pos.begin(), pos.end(), v[i]) - pos.begin();
    ans = min(ans, (int)pos.size() - p + i);
  }
  cout << ans << endl;
}
