#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long inf = LONG_LONG_MIN;
long long n, m, ans = 0;
const long long maxn = 1e5 + 5;
int x[maxn];
int h[maxn];
int main() {
  scanf("%d%d", &n, &m);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", x + i);
  }
  sort(x, x + n);
  int x1, x2, y1, num = 0;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", &x1, &x2, &y1);
    if (x1 == 1) {
      h[num++] = x2;
    }
    if (x2 == INF) ans++;
  }
  sort(h, h + num);
  ans += n;
  int i = 0, j = 0, cnt = num;
  while (i < n) {
    while (j < num && h[j] < x[i]) {
      cnt--;
      j++;
    }
    ans = min(ans, cnt + i);
    if (ans == 0) break;
    ++i;
  }
  cout << ans << endl;
  return 0;
}
