#include <bits/stdc++.h>
using namespace std;
vector<int> vv1, vv2;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    vv2.push_back(x);
  }
  for (int i = 1; i <= m; i++) {
    int x1, x2, y;
    scanf("%d %d %d", &x1, &x2, &y);
    if (x1 == 1) {
      if (x2 == 1000000000)
        ans++;
      else
        vv1.push_back(x2);
    }
  }
  sort(vv1.begin(), vv1.end());
  sort(vv2.begin(), vv2.end());
  int mn = vv2.size(), z = 0;
  for (int i = 0; i < vv2.size(); i++) {
    int id = lower_bound(vv1.begin(), vv1.end(), vv2[i]) - vv1.begin();
    int kk = vv1.size() - id;
    kk += z;
    z++;
    mn = min(kk, mn);
  }
  ans += mn;
  cout << ans;
}
