#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long dp[2005][2005];
long long calc(long long arr[], int l, int r) {
  if (l > r) return 0;
  if (dp[l][r] != -1) {
    return dp[l][r];
  }
  long long int curr = arr[r] - arr[l];
  long long val1 = calc(arr, l, r - 1);
  long long val2 = calc(arr, l + 1, r);
  return dp[l][r] = min(val1, val2) + curr;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  for (int z = 0; z < t; z++) {
    int n, m;
    cin >> n >> m;
    vector<long long> seg;
    seg.push_back(0);
    seg.push_back(1e9);
    long long val;
    for (int i = 0; i < n; i++) {
      cin >> val;
      seg.push_back(val);
    }
    sort(seg.begin(), seg.end());
    long long int countSeg[n + 4];
    memset(countSeg, 0, sizeof(countSeg));
    for (int y = 0; y < m; y++) {
      cin >> val;
      if (val != 1) {
        cin >> val >> val;
        continue;
      }
      cin >> val;
      auto it = upper_bound(seg.begin(), seg.end(), val);
      countSeg[0]++;
      int ind = it - seg.begin();
      countSeg[ind]--;
      cin >> val;
    }
    for (int i = 1; i <= n + 3; i++) {
      countSeg[i] += countSeg[i - 1];
    }
    long long int ans = INT_MAX;
    for (long long int i = 0; i <= n; i++) {
      ans = min(ans, i + countSeg[i + 1]);
    }
    cout << ans << "\n";
  }
  return 0;
}
