#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000000000;
const int M1 = 1000000007;
const int M2 = 998244353;
const int N = 100005;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, m, k, a, b, temp, x, y;
  cin >> n >> m;
  vector<int> vertical;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    vertical.push_back(temp);
  }
  sort(vertical.begin(), vertical.end());
  vector<int> start;
  vector<int> endd;
  start.push_back(1);
  for (int i = 0; i < n; i++) {
    start.push_back(vertical[i]);
    endd.push_back(vertical[i]);
  }
  endd.push_back(MAX);
  int pre[n + 2];
  for (int i = 0; i < n + 2; i++) {
    pre[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> temp;
    if (x == 1) {
      int first = lower_bound(start.begin(), start.end(), x) - start.begin();
      int second = lower_bound(endd.begin(), endd.end(), y) - endd.begin();
      if (endd[second] == y) {
        second += 2;
        first++;
      } else {
        second++;
        first++;
      }
      if (first <= second) {
        pre[first]++;
        pre[second]--;
      }
    }
  }
  cout << "\n";
  int sm = pre[0];
  int ans = MAX;
  for (int i = 0; i < n + 1; i++) {
    sm += pre[i + 1];
    ans = min(ans, i + sm);
  }
  cout << ans;
}
