#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
void DEBUG(string label, T value) {
  cerr << "[" << label << " = " << value << "]\n";
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> vertical(n);
  for (int i = 0; i < n; ++i) {
    cin >> vertical[i];
  }
  map<int, vector<pair<int, int>>> hor;
  for (int i = 0; i < m; ++i) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    hor[y].push_back({x1, x2});
  }
  vector<int> endpoints;
  for (auto el : hor) {
    sort(el.second.begin(), el.second.end());
    vector<pair<int, int>> points = el.second;
    if (points[0].first != 1) continue;
    int last = 0;
    for (int j = 0; j + 1 < (int)points.size(); ++j) {
      if (points[j].second + 1 != points[j + 1].first) {
        last = j;
        break;
      }
      if (j == (int)points.size() - 2) {
        if (points[j].second + 1 == points[j + 1].first) {
          last = j + 1;
        }
        break;
      }
    }
    int endpoint = points[last].second;
    endpoints.push_back(endpoint);
  }
  sort(vertical.begin(), vertical.end());
  sort(endpoints.begin(), endpoints.end());
  int ans = 1 << 30;
  for (int i = 0; i < n; ++i) {
    int num = lower_bound(endpoints.begin(), endpoints.end(), vertical[i]) -
              endpoints.begin();
    int count = (int)endpoints.size() - num;
    ans = min(ans, i + count);
  }
  int num = lower_bound(endpoints.begin(), endpoints.end(), (int)(1e9)) -
            endpoints.begin();
  int count = (int)endpoints.size() - num;
  ans = min(ans, n + count);
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
