#include <iostream>
#include <vector>
#include<string>
#include <algorithm>
#include <cmath>
using namespace std;
#define all(v) (v.begin()),(v.end())
int main() {
int n, m;
cin >> n >> m;
vector<int> arrN;
vector<int> arrM;
int temp = 0;
while (temp < n){
int x;
cin >> x;
arrN.push_back(x);
temp++;
}
temp = 0;
while (temp < m){
int x;
cin >> x;
arrM.push_back(x);
temp++;
}
for (int i = 0; i < arrN.size(); i++){
int e = arrN[i];
auto it = find(all(arrM), e);
if (it == arrM.end()){
arrN.erase(arrN.begin() + i);
}
}
int count = 0;
for (int i = 0; i < arrN.size(); i++){
if (arrN[i] == arrM[i]){
count++;
}
}
if (count == arrN.size()){
cout << "YES";
}else{
cout << "NO";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZTxzdHJpbmc+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxjbWF0aD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgYWxsKHYpICh2LmJlZ2luKCkpLCh2LmVuZCgpKQoKaW50IG1haW4oKSB7CiAgICBpbnQgbiwgbTsKICAgIGNpbiA+PiBuID4+IG07CiAgICB2ZWN0b3I8aW50PiBhcnJOOwogICAgdmVjdG9yPGludD4gYXJyTTsKCiAgICBpbnQgdGVtcCA9IDA7CiAgICB3aGlsZSAodGVtcCA8IG4pewogICAgICAgIGludCB4OwogICAgICAgIGNpbiA+PiB4OwogICAgICAgIGFyck4ucHVzaF9iYWNrKHgpOwogICAgICAgIHRlbXArKzsKICAgIH0KICAgIHRlbXAgPSAwOwogICAgd2hpbGUgKHRlbXAgPCBtKXsKICAgICAgICBpbnQgeDsKICAgICAgICBjaW4gPj4geDsKICAgICAgICBhcnJNLnB1c2hfYmFjayh4KTsKICAgICAgICB0ZW1wKys7CiAgICB9CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBhcnJOLnNpemUoKTsgaSsrKXsKICAgICAgICBpbnQgZSA9IGFyck5baV07CiAgICAgICAgYXV0byBpdCA9IGZpbmQoYWxsKGFyck0pLCBlKTsKICAgICAgICBpZiAoaXQgPT0gYXJyTS5lbmQoKSl7CiAgICAgICAgICAgIGFyck4uZXJhc2UoYXJyTi5iZWdpbigpICsgaSk7CiAgICAgICAgfQogICAgfQogICAgaW50IGNvdW50ID0gMDsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXJyTi5zaXplKCk7IGkrKyl7CiAgICAgICAgaWYgKGFyck5baV0gPT0gYXJyTVtpXSl7CiAgICAgICAgICAgIGNvdW50Kys7CiAgICAgICAgfQogICAgfQogICAgaWYgKGNvdW50ID09IGFyck4uc2l6ZSgpKXsKICAgICAgICBjb3V0IDw8ICJZRVMiOwogICAgfWVsc2V7CiAgICAgICAgY291dCA8PCAiTk8iOwogICAgfQogICAgcmV0dXJuIDA7Cn0=