#include <bits/stdc++.h>
using namespace std;
int x[200005], ps[200005];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> x[i];
  int ans = 0, id = 0;
  for (int x1, x2, y, i = 1; i <= m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 == 1) {
      ps[id] = x2;
      id++;
    }
    if (x2 == 1000000000) ans++;
  }
  sort(x + 1, x + n + 1);
  sort(ps, ps + id);
  int cnt = id;
  ans += n;
  int j = 0;
  for (int i = 1; i <= n; i++) {
    for (; j < id;) {
      if (ps[j] < x[i]) {
        j++;
        cnt--;
      } else
        break;
    }
    ans = min(ans, cnt + i - 1);
  }
  cout << ans << endl;
  return 0;
}
