import std.stdio;
import std.string;
 
void main()
{
    char[] s = readln.chomp.dup;
    char[] t = readln.chomp.dup;
    string ans = "No";

    foreach (i; 0..s.length){ 
        s = s[$ - 1] ~ s[0..$ - 1];
        if (s == t){
            ans = "Yes";
            break;
        }
    }
    writeln(ans);
}
