function main(input) {
  input=input.trim();
  var s = input.split("\n")[0]
  var t = input.split("\n")[1]
  const nagasa=s.length
  var ans=0;
  for(var i=0; i<nagasa; i++){
    s=s.charAt(nagasa-1)+s.slice(0,nagasa-1);
    //console.log(s);
      if(s==t){
        ans++
      }
    }
    
  if(ans>0||input.split("\n")[0]==t){
    console.log("Yes");
  }else{
    console.log("No");
  }
}

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

