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