#include <bits/stdc++.h>
using namespace std;
char getc() {
  char c = getchar();
  while ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) c = getchar();
  return c;
}
int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
int n, m, line[100010], row[100010];
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) line[i] = read();
  line[++n] = 1000000000;
  sort(line + 1, line + n + 1);
  int t = 0;
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    read();
    if (x == 1) row[++t] = y + 1;
  }
  sort(row + 1, row + t + 1);
  int x = 0, cnt = t, ans = n + m;
  for (int i = 1; i <= n; i++) {
    while (x < t && row[x + 1] <= line[i]) x++, cnt--;
    ans = min(ans, cnt + i - 1);
  }
  cout << ans;
  return 0;
}
