import std.stdio;
import std.string;
 
void main()
{
    string t_s, t;
    readf(" %s %s", &t_s, &t);
    string ans = "No";
 	char[] s = t_s.dup;
  
    foreach (i; 0..s.length){
        s = s[$ - 1] ~ s[0..$ - 1];
        if (s == t){
            ans = "Yes";
            break;
        }
    }
    writeln(ans);
}
