unittest
{
	assert( [ "5", "3 1 4 1 5", "3", "5 4 3" ].parse.expand.solve == "YES" );
	assert( [ "7", "100 200 500 700 1200 1600 2000", "6", "100 200 500 700 1600 1600" ].parse.expand.solve == "NO" );
	assert( [ "1", "800", "5", "100 100 100 100 100" ].parse.expand.solve == "NO" );
	assert( [ "15", "1 2 2 3 3 3 4 4 4 4 5 5 5 5 5", "9", "5 4 3 2 1 2 3 4 5" ].parse.expand.solve == "YES" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto ds = input.front.split.to!( long[] );
	input.popFront;
	input.popFront;
	auto ts = input.front.split.to!( long[] );
	return tuple( ds, ts );
}

auto solve( long[] ds, long[] ts )
{
	ds.sort();
	ts.sort();
	while( !ds.empty && !ts.empty )
	{
		if( ds.front == ts.front ) ts.popFront;
		ds.popFront;
	}
	return ( ts.empty ) ? "YES" : "NO";
}
