#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 1e5 + 5;
constexpr int MOD = 998244353;
constexpr int INF = 1e9;
constexpr int LOG = 10;
struct spell {
  int x1, x2, y;
  void get() {
    cin >> x1 >> x2 >> y;
    x1--;
  }
};
int n, m, part[MAXN];
vector<int> ver, hor;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    ver.push_back(x);
  }
  ver.push_back(INF);
  for (int i = 0; i < m; i++) {
    int x, xx, y;
    cin >> x >> xx >> y;
    if (x == 1) {
      hor.push_back(xx);
    }
  }
  sort(ver.begin(), ver.end());
  sort(hor.begin(), hor.end());
  int ans = INF;
  for (int i = 0; i < ver.size(); i++) {
    int idx = lower_bound(hor.begin(), hor.end(), ver[i]) - hor.begin();
    ans = min(ans, i + (int)hor.size() - idx);
  }
  cout << ans;
  return 0;
}
