#include <iostream>                                                              
#include <algorithm>                                                             
#include <cstring>                                                               
#include <vector>                                                                
#include <numeric>                                                               
#include <cstdlib>                                                               
#include <queue>                                                                 
#include <stack>                                                                 
#include <climits>                                                               
using namespace std;                                                             
                                                                                 
typedef long long ll;                                                            
#define pb push_back                                                             
                                                                                 
#define rep(i, n) for (int i=0;i<(n);++i)                                        
#define rep2(i, s, n) for (int i=s;i<(n);++i)                                    
#define rev(i, n) for (int i=(n);i>0;--i)                                        
#define INF (1e9+1e9)                                                            
                                                                                 
int main() {                                                                     
    ll n; cin>>n;                                                                
                                                                                 
    vector<ll> D(n);                                                             
                                                                                 
    rep(i,n) {                                                                   
        ll d; cin>>d;                                                            
        D[i] = d;                                                                
    }                                                                            
    int m; cin>>m;                                                               
    vector<ll> T(m);                                                             
    rep(i,m) {                                                                   
        ll t; cin>>t;                                                            
        T[i] = t;                                                                
    }                                                                            
    sort(D.begin(), D.end());                                                    
    sort(T.begin(), T.end());                                                    
                                                                                 
    for(int i=0,j=0; i < m;) {                                                   
        if(D[j] > T[i]) { cout << "NO" << endl; return 0;}                       
        if (D[j] < T[i]) ++j;                                                    
        if (D[j] == T[i]) {++i; ++j;}                                            
    }                                                                            
    cout << "YES" << endl;                                                       
}                                                                                
   

Measured memory_bytes: 3328