#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, a[N], ans = 1e9;
vector<int> v;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  sort(a, a + n);
  for (int i = 0, a, b, y; i < m; i++) {
    scanf("%d%d%d", &a, &b, &y);
    if (a == 1) v.push_back(b);
  }
  sort(v.begin(), v.end());
  a[n] = 1e9;
  int j = 0;
  for (int i = 0; i < n + 1; i++) {
    while (j < v.size() && v[j] < a[i]) j++;
    ans = min(ans, (int)v.size() - j + i);
  }
  printf("%d\n", ans);
}
