#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 10;
struct Data {
  int l, r, y;
  Data(int _l = 0, int _r = 0, int _y = 0) : l(_l), r(_r), y(_y){};
  bool operator<(const Data &other) const { return r < other.r; }
};
int n, m;
int a[N];
Data b[N];
void Read_Input() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int _m = 0;
  for (int i = 1; i <= m; i++) {
    int l, r, y;
    scanf("%d%d%d", &l, &r, &y);
    if (l == 1) b[++_m] = Data(l, r, y);
  }
  m = _m;
  sort(a + 1, a + 1 + n);
  sort(b + 1, b + 1 + m);
  a[0] = 0;
  a[n + 1] = 1E9;
}
void Solve() {
  int ver = 1E9, ans = n + m;
  int j = 1;
  for (int i = 0; i <= n; i++) {
    while (j <= m && b[j].r < a[i + 1]) j++;
    ans = min(ans, i + (m - j + 1));
  }
  printf("%d", ans);
}
int main() {
  Read_Input();
  Solve();
  return 0;
}
