var x = require("fs").readFileSync("/dev/stdin", "utf8");
x = x.split("\n");
var a = x[0], b = x[1];

for(var i=0; i<2;i++){
 a += a; 
}

if(a.includes(b) === true){
 console.log("Yes"); 
} else {
 console.log("No"); 
}
