#include <bits/stdc++.h>
using namespace std;
void log_time(string s) {
  if (true) {
    chrono::milliseconds ms = chrono::duration_cast<chrono::milliseconds>(
        chrono::system_clock::now().time_since_epoch());
    cout << s << ":" << ms.count() << endl;
  }
}
long long gcd(long long x, long long y) { return y == 0LL ? x : gcd(y, x % y); }
void bfs(vector<string> &adj, vector<char> &color, int s,
         vector<vector<int> > &distance) {
  queue<int> q;
  q.push(s);
  distance[s][s] = 0;
  color[s] = 'g';
  while (!q.empty()) {
    int curr = q.front();
    q.pop();
    for (int i = 0; i < int(adj.size()); i++) {
      if (adj[curr][i] == '1') {
        int next = i;
        if (color[next] == 'w') {
          color[next] = 'g';
          distance[s][next] = distance[s][curr] + 1;
          q.push(next);
        }
      }
    }
  }
}
bool comparator(const pair<long long, long long> &x,
                const pair<long long, long long> &y) {
  return x.second - x.first < y.second - y.first;
}
long from_line_id(vector<long long> &vertical, long long x) {
  vector<long long>::iterator it =
      lower_bound(vertical.begin(), vertical.end(), x);
  return (it - vertical.begin());
}
long to_line_id(vector<long long> &vertical, long long x) {
  vector<long long>::iterator it =
      lower_bound(vertical.begin(), vertical.end(), x);
  if ((*it) != x) {
    it--;
  }
  return (it - vertical.begin());
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  long long max_coord = 1000LL * 1000LL * 1000LL;
  vector<long long> vertical(n);
  for (int i = 0; i < int(n); i++) {
    cin >> vertical[i];
  }
  vertical.push_back(max_coord);
  sort(vertical.begin(), vertical.end());
  long long x1, x2, y;
  vector<long long> horizontals;
  long max_x_count = 0LL;
  for (int i = 0; i < int(m); i++) {
    cin >> x1 >> x2 >> y;
    if (x1 != 1LL) {
      continue;
    }
    if (x2 == max_coord) {
      max_x_count++;
    }
    horizontals.push_back(x2);
  }
  sort(horizontals.begin(), horizontals.end());
  if (n == 0) {
    cout << max_x_count << endl;
  } else {
    long solution = LONG_MAX;
    for (int i = 0; i < int(vertical.size()); i++) {
      long long to_search = vertical[i] - 1;
      vector<long long>::iterator it =
          upper_bound(horizontals.begin(), horizontals.end(), to_search);
      long intersections = horizontals.end() - it;
      solution = min(solution, intersections + i);
    }
    cout << solution << endl;
  }
  return 0;
}
