#include <bits/stdc++.h>
using namespace std;
int n, m, x[100005], y[100005], cn[100005], cnt, l, ans;
pair<int, int> p[100005];
int bs(int a, int l, int r) {
  if (x[r] <= a) {
    if (r == n)
      return r;
    else if (x[r + 1] > a)
      return r;
  }
  int mid = (l + r) / 2;
  if (x[mid] <= a)
    return bs(a, mid, r - 1);
  else
    return bs(a, l, mid);
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> x[i];
  for (int i = 1; i <= m; ++i) {
    cin >> p[i].first >> p[i].second >> y[i];
    if (p[i].second - p[i].first + 1 == 1e9) ++l;
  }
  if (m == 0) return cout << 0, 0;
  if (n == 0) return cout << l, 0;
  sort(x + 1, x + n + 1);
  int t = 0;
  for (int i = 1; i <= m; ++i) {
    if (p[i].first == 1 && x[1] <= p[i].second &&
        p[i].second - p[i].first + 1 < 1e9)
      ++t, cn[t] = bs(p[i].second, 1, n);
  }
  sort(cn + 1, cn + t + 1);
  int cnt = 2e9;
  for (int i = 0; i <= t; ++i) {
    ans = cn[i];
    while (cn[i] == cn[i + 1]) ++i;
    ans += max(0, t - i);
    cnt = min(cnt, ans);
  }
  cout << cnt + l;
}
