#include <bits/stdc++.h>
using namespace std;
vector<int> vert;
vector<int> horz;
int main() {
  int n, m;
  cin >> n >> m;
  int cnt = 0;
  int ignor = 0;
  for (int x = 0; x < n; ++x) {
    int a;
    cin >> a;
    vert.push_back(a);
  }
  for (int z = 0; z < m; z++) {
    int s, d, f;
    cin >> s >> d >> f;
    d - s + 1;
    if (d - s + 1 == 1000000000)
      cnt++;
    else if (s != 1)
      ignor++;
    else
      horz.push_back(d - s + 1);
  }
  m -= cnt;
  m -= ignor;
  if (n == 0 || m == 0) {
    cout << cnt;
    return 0;
  }
  sort(vert.begin(), vert.end());
  sort(horz.begin(), horz.end());
  int res = 2000000000;
  for (int i = 0; i < n; ++i) {
    int h = vert[i];
    int startt = 0;
    int endd = horz.size() - 1;
    while (startt < endd) {
      int mid = (startt + endd) / 2;
      if (horz[mid] >= h)
        endd = mid;
      else
        startt = mid + 1;
    }
    int intersect;
    if (horz[startt] >= h)
      intersect = horz.size() - startt;
    else
      intersect = 0;
    int check = min(intersect + i, n);
    res = min(res, check);
  }
  cout << res + cnt;
  return 0;
}
