#include <iostream>
#include <cmath>
#include <cctype>
#include <string>
#include <algorithm>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
int sizeN = N, sizeM = M;
long long arrayM[10000], arrayN[10000];
for (int i = 0; i < N; i++)
{
cin >> arrayN[i];
}
for (int i = 0; i < M; i++)
{
cin >> arrayM[i];
}
int cnt=0;
int j = 0;
bool H = false;
for (int i = 0; i < M; i++)
{
for ( j ; j < N; j++)
{
if (arrayM[i]==arrayN[j])
{
cnt++;
H = true;
break;
}
}
if (H==true)
{
j = j + 1;
}
else
{
break;
}
}
if (cnt==M)
{
cout << "YES";
}
else
{
cout << "NO";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+IAojaW5jbHVkZSA8Y2N0eXBlPiAKI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGFsZ29yaXRobT4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgoKCmludCBtYWluKCkgewoKICAgIGludCBOLCBNOwogICAgY2luID4+IE4gPj4gTTsKCiAgICBpbnQgc2l6ZU4gPSBOLCBzaXplTSA9IE07CgogICAgbG9uZyBsb25nIGFycmF5TVsxMDAwMF0sIGFycmF5TlsxMDAwMF07CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspCiAgICB7CiAgICAgICAgY2luID4+IGFycmF5TltpXTsKICAgIH0KCiAgICBmb3IgKGludCBpID0gMDsgaSA8IE07IGkrKykKICAgIHsKICAgICAgICBjaW4gPj4gYXJyYXlNW2ldOwogICAgfQoKICAgIGludCBjbnQ9MDsKICAgIGludCBqID0gMDsKICAgIGJvb2wgSCA9IGZhbHNlOwoKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTTsgaSsrKQogICAgewogICAgICAgCiAgICAgICAgZm9yICggaiA7IGogPCBOOyBqKyspCiAgICAgICAgewogICAgICAgICAgICBpZiAoYXJyYXlNW2ldPT1hcnJheU5bal0pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGNudCsrOyAKICAgICAgICAgICAgICAgIEggPSB0cnVlOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgCiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIGlmIChIPT10cnVlKQogICAgICAgIHsKICAgICAgICAgICAgaiA9IGogKyAxOwogICAgICAgIH0KICAgICAgICBlbHNlCiAgICAgICAgewogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgIAogICAgfQogICAKICAgIGlmIChjbnQ9PU0pCiAgICB7CiAgICAgICAgY291dCA8PCAiWUVTIjsKICAgIH0KICAgIGVsc2UKICAgIHsKICAgICAgICBjb3V0IDw8ICJOTyI7CiAgICB9CiAgIAoKCgoKICAgIHJldHVybiAwOwoKfQ==