#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int y[N], pos[N];
int main() {
  int n, m, t = 0, ans = 0, cnt = 0;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &y[i]);
  for (int i = 1; i <= m; i++) {
    int y1, y2, x;
    scanf("%d %d %d", &y1, &y2, &x);
    if (y1 == 1) {
      pos[++t] = y2;
    }
    if (y2 == 1e9) {
      ans++;
    }
  }
  sort(y + 1, y + 1 + n);
  sort(pos + 1, pos + 1 + t);
  int i = 1, j = 1;
  cnt = t, ans += n;
  while (i <= n) {
    while (j <= t) {
      if (pos[j] < y[i]) {
        j++, cnt--;
      } else
        break;
    }
    ans = min(ans, cnt + i - 1);
    i++;
  }
  cout << ans;
}
