#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 50;
const int inf = 1e9;
struct node {
  int x;
  bool tag;
  friend bool operator<(const node &a, const node &b) {
    if (a.x == b.x) return !a.tag;
    return a.x < b.x;
  }
};
node st[maxn];
int col[maxn];
int row[maxn];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", col + i);
  int cnt = 0;
  for (int i = 0; i < m; ++i) {
    int x1, x2, y;
    scanf("%d %d %d", &x1, &x2, &y);
    if (x1 == 1) row[cnt++] = x2;
  }
  for (int i = 0; i < n; ++i) {
    st[i].x = col[i];
    st[i].tag = false;
  }
  for (int i = 0; i < cnt; ++i) {
    st[i + n].x = row[i];
    st[i + n].tag = true;
  }
  int cur = cnt;
  int ans = cnt;
  n += cnt;
  sort(st, st + n);
  for (int i = 0; i < n; ++i) {
    if (st[i].x == inf) break;
    if (st[i].tag)
      cur--;
    else
      cur++;
    ans = min(ans, cur);
  }
  printf("%d\n", ans);
  return 0;
}
