#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000, maxint = 2147483647;
int n, m;
int a[maxn];
struct Heng {
  int x1, x2, y;
} b[maxn];
int f[maxn];
int t = 0;
bool cmp(Heng a, Heng b) { return a.x2 < b.x2; }
int solve(int now) {
  int yy = a[now];
  int l = 0, r = t + 1;
  while (l + 1 < r) {
    int m = (l + r) / 2;
    if (b[m].x2 < yy) {
      l = m;
    } else {
      r = m;
    }
  }
  return t - l - 1;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  a[n] = 1000000000;
  sort(a, a + n + 1);
  for (int i = 0; i < m; i++) {
    int x1, x2, y;
    cin >> x1 >> x2 >> y;
    if (x1 != 1) continue;
    b[t].x1 = x1;
    b[t].x2 = x2;
    b[t].y = y;
    t++;
  }
  b[t].x1 = 0;
  b[t].x2 = 0;
  b[t].y = 1;
  t++;
  b[t].x1 = 0;
  b[t].x2 = maxint;
  sort(b, b + t + 1, cmp);
  int ans = maxint;
  for (int i = 0; i <= n; i++) {
    int tmp = i + solve(i);
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}
