#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 5;
const long long INF = 1e18 + 5;
const long long maxn = 5e5 + 5;
long long n, b[555555], mx = -1000000001;
long long a[555555], c[555555], sum, cnt, ans;
set<int> second;
pair<int, pair<int, int> > p[555555];
vector<long long> v, x, y;
map<int, int> m;
long long t[4 * 100000];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  a[n + 1] = 1e9;
  for (int i = 1; i <= m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    if (l == 1) b[++sum] = r;
  }
  sort(b + 1, b + sum + 1);
  int l = 0;
  for (int i = 1; i <= sum; i++) {
    if (a[1] <= b[i]) {
      l = i;
      break;
    }
  }
  int c = 0;
  for (int i = 1; i <= sum; i++)
    if (b[i] == 1e9) c++;
  if (l == 0) l = sum + 1;
  long long mn = 1e9;
  mn = sum - l + 1;
  for (int i = 2; i <= n + 1; i++) {
    while (a[i] > b[l] && sum >= l) l++;
    mn = min(mn, sum - l + i);
  }
  cout << mn;
  return 0;
}
