#include <bits/stdc++.h>
using namespace std;
int main() {
  int cou = 0, le, ri, h, n, m, totb = 0, a[100010] = {0}, b[100010] = {0};
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> le >> ri >> h;
    if (le == 1) {
      if (ri == 1000000000)
        cou++;
      else
        b[++totb] = ri;
    }
  }
  sort(a + 1, a + 1 + n);
  sort(b + 1, b + 1 + totb);
  for (int i = 1, j = 1; i <= n && j <= totb;) {
    if (b[j] >= a[i])
      cou++, i++, j++;
    else
      j++;
  }
  cout << cou;
  return 0;
}
