#include <bits/stdc++.h>
using namespace std;
const int maxn = 300017;
const long long mod = 998244353;
const long long ool = 1e18 + 7;
const int ooi = 1e9 + 7;
const int apsz = 26;
const int o = 1;
const int maxd = 20;
const double eps = 1e-8;
const int rb = 1000000000;
int vb[maxn];
int hb[maxn][3];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> hh;
  for (int i = (0); i < (n); ++i) cin >> vb[i];
  sort(vb, vb + n);
  for (int i = (0); i < (m); ++i) {
    cin >> hb[i][0] >> hb[i][1] >> hb[i][2];
    if (hb[i][0] != 1) continue;
    hh.push_back(hb[i][1]);
  }
  sort(hh.begin(), hh.end());
  vb[n] = rb;
  int now = vb[0];
  int p1 = 0;
  int ans = 0;
  int has = 0;
  for (auto x : hh) {
    if (now > x) continue;
    if (x == rb)
      ans++;
    else {
      has++;
      int p2 = upper_bound(vb, vb + n, x) - vb;
      int ta = max(0, p2 - p1);
      if (has >= ta) {
        ans += ta;
        has = 0;
        now = vb[p2];
        p1 = p2;
      }
    }
  }
  cout << has + ans << endl;
  return 0;
}
