import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.format,
       std.math;

void main()
{
	auto s = readln.chomp;
	auto t = readln.chomp;
	int a;
	foreach(i; 0..s.length){
		if(s == t){
			a = 1;
			break;
		}else{
			s ~= s.front;
			s.popFront();
		}
	}
	if(a == 1) writeln("Yes");
	else writeln("No");
}