#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef pair<ll, ll> pl;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define max(a, b) (a>b ? a : b)
#define min(a, b) (a<b ? a : b)
#define FAST ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)
const int N = int(1e6) + 3;
const int MOD = int(1e9) + 7;
int n,m;
string s;
ll h[N];
ll dp[N];
int x,y;
int main() {
FAST;
//freopen("easy", "r", stdin);
cin >> n >> m;
for(int i=0;i<n;i++){
cin >> x;
h[x]++;
}
for(int i=0;i<m;i++){
cin >> x >> y;
dp[y]++;
}
ll ans=0;
for(int i=2e5;i>=1;i--){
h[i]+=h[i+1];
if(dp[i])
continue;
ans+=(h[i]);
}
cout << ans << endl;
return 0;
}
Copy