#include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647;
const int MAX = 1e5 + 10;
const int mod = 1e9 + 7;
int n, m, ans, ma, mb;
int h[MAX], book[MAX];
void Init() {
  ma = 0;
  mb = 0;
  ans = 0;
  memset(book, 0, sizeof(book));
}
int main() {
  Init();
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
  }
  sort(h + 1, h + n + 1);
  int a, b, c;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b >> c;
    if (a > 1) continue;
    if (b == 1e9) {
      ans++;
      continue;
    }
    int temp = upper_bound(h + 1, h + n + 1, b) - h - 1;
    while (book[temp]) temp--;
    if (temp >= 0) book[temp] = 1;
  }
  for (int i = 1; i <= n; i++) {
    if (book[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}
