#include <bits/stdc++.h>
using namespace std;
int n, m;
int ver[100005];
pair<int, int> hor[100005];
int endwith[100005];
int main() {
  cin.sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < int(n); ++i) {
    cin >> ver[i];
  }
  sort(ver, ver + n);
  int comp = 0;
  int cnt = 0;
  for (int i = 0; i < int(m); ++i) {
    int x;
    cin >> hor[i].first >> hor[i].second >> x;
    if (hor[i].first == 1 && hor[i].second == (int)1e9) {
      comp++;
      continue;
    }
    if (hor[i].first > 1) {
      continue;
    }
    int st = 0, en = n - 1;
    int mx = -1;
    while (st <= en) {
      int mid = st + (en - st) / 2;
      if (ver[mid] <= hor[i].second) {
        st = mid + 1;
        mx = max(mx, mid);
      } else {
        en = mid - 1;
      }
    }
    if (mx != -1) {
      endwith[mx]++;
      cnt++;
    }
  }
  int ans = cnt;
  for (int i = 0; i < int(n); ++i) {
    cnt -= endwith[i];
    ans = min(ans, i + 1 + cnt);
  }
  cout << ans + comp << endl;
}
