#include <iostream>
using namespace std;
int main()
{
int n , m;
cin >> n >> m;
int bozorg[n] , kuchik[m];
for ( int i = 0 ; i < n ; i ++ )
{
cin >> bozorg[i];
}
for ( int i = 0 ; i < m ; i ++ )
{
cin >> kuchik[i];
}
int tekrar = 0;
int Btekrar = 0;
int komaki ;
for ( int x = 0 ; x < n - 1 ; x ++ )
{
komaki = x;
for ( int y = n - 1 ; y > komaki ; y -- )
{
if ( bozorg [komaki] == bozorg [y] )
{
tekrar ++;
}
}
Btekrar = n - tekrar;
}
int arr [Btekrar];
for ( int x = 0 ; x < Btekrar ; x ++ )
{
komaki = x;
for ( int y = n - 1 ; y > komaki ; y -- )
{
if ( bozorg [komaki] == bozorg [y] )
{
arr[x] = bozorg [komaki];
}
else if ( y - komaki == 1 )
{
arr[x] = bozorg [komaki];
}
}
}
int all = 0;
for ( int x = 0 ; x < m ; x ++ )
{
for ( int y = 0 ; y < Btekrar ; y ++ )
{
if ( kuchik[x] == arr[y] )
{
all ++;
}
}
}
if ( all == m )
{
cout << "Yes";
}
else
{
cout << "No";
}
return 0;
}