#include <bits/stdc++.h>
using namespace std;
const int INF = 1231231234;
const int MOD = 1000000007;
const double EPS = 1e-8;
const int MAXN = 1000000000;
struct edge {
  int to;
};
struct segment {
  int l, r;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x + 1);
  }
  v.push_back(MAXN + 1);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  vector<segment> h;
  vector<int> blocked(v.size());
  for (int i = 0; i < m; i++) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      h.push_back({x1, x2 + 1});
      int pos = upper_bound(v.begin(), v.end(), x2 + 1) - v.begin() - 1;
      if (pos != -1) {
        blocked[pos]++;
      }
    }
  }
  for (int i = v.size() - 2; i >= 0; i--) {
    blocked[i] += blocked[i + 1];
  }
  int best = INF;
  for (int i = 0; i < v.size(); i++) {
    int possible = i + blocked[i];
    best = min(possible, best);
  }
  cout << best << '\n';
}
