#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
const int inf = 1e9;
int a[maxn], b[maxn];
void solve() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int s = 0;
  for (int i = 1; i <= m; i++) {
    int x1, x2, y;
    scanf("%d%d%d", &x1, &x2, &y);
    if (x1 == 1) {
      if (x2 == inf)
        s++;
      else {
        int k = upper_bound(a + 1, a + n + 1, x2) - a - 1;
        while (b[k]) k--;
        if (k) {
          s++, b[k] = 1;
        }
      }
    }
  }
  printf("%d\n", s);
}
int main() { solve(); }
