#include <bits/stdc++.h>
using namespace std;
const int64_t MAXN = 100010;
int64_t N, M;
int64_t vertices[MAXN];
struct Line {
  int64_t from, to, height;
};
vector<int64_t> lines;
int64_t linesToRemove(int64_t removedVertices) {
  return lines.size() -
         (lower_bound(lines.begin(), lines.end(), vertices[removedVertices]) -
          lines.begin());
}
int main() {
  cin >> N >> M;
  for (int64_t i = 0; i < N; i++) {
    cin >> vertices[i];
  }
  sort(vertices, vertices + N);
  vertices[N] = 1e9;
  N++;
  int64_t nr = 0;
  for (int64_t j = 1; j <= M; j++) {
    int64_t from, to, height;
    cin >> from >> to >> height;
    if (from != 1) {
      continue;
    }
    nr++;
    lines.push_back(to);
  }
  M = nr;
  sort(lines.begin(), lines.end());
  int64_t mn = 1e16;
  for (int64_t nrToDelete = 0; nrToDelete < N; nrToDelete++) {
    mn = min(mn, nrToDelete + linesToRemove(nrToDelete));
  }
  cout << mn;
  return 0;
}
