import std.stdio, std.string, std.conv;
import std.algorithm;

void main() {
	auto input = getStdin!(string[]);
	string s = input[0] ~ input[0];
	string p = input[1];
	if (s.count(p) > 0) {
		"Yes".writeln;
	}
	else {
		"No".writeln;
	}
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}