#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  if (!y) return x;
  return gcd(y, x % y);
}
int expo(int x, int y, int m) {
  int res = 1LL;
  while (y) {
    if (y & 1) res = (res * x) % m;
    x = (x * x) % m;
    y /= 2;
  }
  return res;
}
class matrix {
 public:
  int a[3][3];
  matrix() { memset(a, 0, sizeof a); }
  int *operator[](int i) { return a[i]; }
  matrix operator*(matrix b) {
    matrix c;
    int i, j, k;
    for (i = 0; i < 3; i++)
      for (j = 0; j < 3; j++)
        for (k = 0; k < 3; k++)
          c[i][j] = (c[i][j] + (a[i][k] * b[k][j]) % 1000000007) % 1000000007;
    return c;
  }
};
matrix expo(matrix x, int y) {
  matrix res;
  int i;
  for (i = 0; i < 3; i++) res[i][i] = 1;
  while (y) {
    if (y & 1) res = (res * x);
    x = (x * x);
    y /= 2;
  }
  return res;
}
int bits(int x) {
  int ans = 0;
  while (x) {
    if (x & 1) ans++;
    x >>= 1;
  }
  return ans;
}
map<int, int> BIT;
const int M = 1000000001;
void upd(int idx, int val) {
  while (idx <= M) BIT[idx] += val, idx += idx & -idx;
}
int query(int idx) {
  int res = 0;
  while (idx) res += BIT[idx], idx -= idx & -idx;
  return res;
}
const int N = 100003;
int a[N], P[N], Q[N];
vector<pair<pair<int, int>, int> > v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, i, x1, x2, y, ans, pre, j = 0;
  cin >> n >> m;
  a[0] = 0;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 0; i < m; i++) {
    cin >> x1 >> x2 >> y;
    if (x1 != 1) continue;
    v.push_back(make_pair(make_pair(x1, 0), i));
    v.push_back(make_pair(make_pair(x2, 1), i));
    P[i] = x1;
    Q[i] = x2;
  }
  sort(a, a + n + 1);
  sort(v.begin(), v.end());
  ans = n + m;
  pre = 0;
  a[n + 1] = 1000000000;
  for (i = 1; i <= n + 1; i++) {
    while (j < v.size() && v[j].first.first < a[i]) {
      if (v[j].first.second == 0)
        upd(v[j].first.first, 1);
      else
        upd(P[v[j].second], -1);
      j++;
    }
    while (j < v.size() && v[j].first.first <= a[i] && v[j].first.second == 0)
      upd(v[j].first.first, 1), j++;
    ans = min(ans, i - 1 + query(pre + 1));
    pre = a[i];
  }
  cout << ans;
}
