#include <bits/stdc++.h>
using namespace std;
vector<int> ver, hor;
bool cmp(pair<int, int> a, pair<int, int> b) { return (a.first < b.first); }
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int x = 1000000000;
  for (int i = (1); i <= (n); i++) {
    int t;
    scanf("%d", &t);
    ver.push_back(t);
  }
  sort(ver.begin(), ver.end());
  if (ver.empty() || ver.back() != 1000000000) ver.push_back(1000000000);
  for (int i = (1); i <= (m); i++) {
    int x1, x2, y;
    scanf("%d %d %d", &x1, &x2, &y);
    if (x1 == 1) hor.push_back(x2);
  }
  sort(hor.begin(), hor.end());
  int p = 0;
  int ans = 1000000000;
  for (int i = (0); i <= (ver.size() - 1); i++) {
    int v = ver[i];
    while (p < hor.size() && hor[p] < v) ++p;
    ans = min(ans, (int)hor.size() - p + i);
  }
  printf("%d\n", ans);
  return 0;
}
