const main = function(input){
  var lines = input.split("\n");
  var s = lines[0];
  var t = lines[1];
  var can = false;
  
  for(var i=0;i<s.length;i++){
    if(s ===t){
      can = true;
      break;
    }
    var last = s.slice(s.length-1,s.length);
    s = last + s.slice(0,-1);
  }
  if(can){
  	console.log("Yes");
  }else{
  	console.log("No");
  }
  
  
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));