import std.conv;
import std.stdio;
import std.string;

void main()
{
	auto s = readln.strip;
	auto t = readln.strip;
	writeln( solve( s, t ) );
}

auto solve( in string s, in string t )
{
	foreach( i; 0 .. t.length )
	{
		auto ts = t[ i .. $ ] ~ t[ 0 .. i ];
		if( s == ts ) return "Yes";
	}

	return "No";
}
