#include <bits/stdc++.h>
using namespace std;
const int BOARD = 1e9;
int N, M;
vector<int> vertical;
vector<int> horizontal;
int main() {
  scanf("%d %d", &N, &M);
  vertical.resize(N);
  for (int &x : vertical) scanf("%d", &x);
  sort(vertical.begin(), vertical.end());
  for (int i = 0; i < M; i++) {
    int x1, x2, y;
    scanf("%d %d %d", &x1, &x2, &y);
    if (x1 == 1) horizontal.push_back(x2);
  }
  sort(horizontal.rbegin(), horizontal.rend());
  vertical.push_back(BOARD);
  int at_least = horizontal.size();
  int answer = BOARD;
  for (int v = 0; v < (int)vertical.size(); v++) {
    int x = vertical[v];
    while (at_least > 0 && horizontal[at_least - 1] < x) at_least--;
    answer = min(answer, v + at_least);
  }
  printf("%d\n", answer);
}
