#include <bits/stdc++.h>
using namespace std;
int a[100001];
int x[100001];
int x1[100001], x2[100001], y[100001];
int ft[100001];
void update(int i, int v) {
  for (; i <= 100000; i += (i & -i)) {
    ft[i] += v;
  }
}
int query(int i) {
  int res = 0;
  for (; i > 0; i -= (i & -i)) {
    res += ft[i];
  }
  return res;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x[i]);
  }
  sort(x + 1, x + 1 + n);
  int cnt = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &x1[i], &x2[i], &y[i]);
    if (x1[i] == 1 && x2[i] == 1e9)
      cnt++;
    else if (x1[i] == 1) {
      int lo = 1, hi = n, last = -1;
      while (lo <= hi) {
        int mid = (lo + hi) / 2;
        if (x[mid] <= x2[i]) {
          last = mid;
          lo = mid + 1;
        } else {
          hi = mid - 1;
        }
      }
      if (last != -1) update(last, 1);
    }
  }
  int ans = 1e9;
  for (int i = 1; i <= n; i++) {
    int q = query(100000) - query(i - 1);
    ans = min(ans, cnt + q + i - 1);
  }
  ans = min(ans, cnt + n);
  printf("%d\n", ans);
}
