#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
int main() {
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  int testNum = 1;
  while (t--) {
    solve(true);
  }
  cout.flush();
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
template <typename T>
void make_unique(vector<T>& a) {
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
}
template <typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}
template <typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}
void precalc() {}
struct Event {
  int x;
  int type;
  bool operator<(const Event& ot) const {
    if (x != ot.x) {
      return x < ot.x;
    }
    return type > ot.type;
  }
};
void solve(__attribute__((unused)) bool read) {
  int n, m;
  cin >> n >> m;
  vector<Event> events;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    events.push_back({x, 1});
  }
  int must = 0;
  int res = 0;
  for (int i = 0; i < m; ++i) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      if (x2 == 1000000000) {
        ++must;
      } else {
        events.push_back({x2, -1});
        ++res;
      }
    }
  }
  sort(events.begin(), events.end());
  int pref = res;
  for (auto& ev : events) {
    pref += ev.type;
    relax_min(res, pref);
  }
  cout << res + must << endl;
}
