#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int vertical[100001];
  int intersect[100001];
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> vertical[i];
    intersect[i] = 0;
  }
  sort(&vertical[0], &vertical[n]);
  int a, b, c;
  int rem = 0;
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> c;
    if (a == 1) {
      int l = 0;
      int r = n - 1;
      int match = -1;
      if (b == 1000000000) rem++;
      while (l <= r) {
        int midpoint = l + (r - l) / 2;
        if (vertical[midpoint] > b)
          r = midpoint - 1;
        else {
          l = midpoint + 1;
          match = midpoint;
        }
      }
      if (match != -1) intersect[match]++;
    }
  }
  int minn = n + rem;
  int result = n;
  for (int i = n - 1; i >= 0; i--) {
    result--;
    result += intersect[i];
    if (result < minn) minn = result;
  }
  cout << minn;
  return 0;
}
