object Main {
  def main(args:String)={
    var S = readLine
  var T = readLine
  var res = true
  if(S.length!=T.length) res= false
  if(res) res = find(S,T)
  if(res) println("Yes")
  else println("No")
  }
  
  
  
  def find(s:String,t:String):Boolean={
    if(s.equals(t)) return true
    var ss = s
    var len = ss.length
    for(i <- 0 until len){
      ss = ss.charAt(len-1) + ss.substring(0,len-1)
      if(ss.equals(t)) return true
    }
    false
  }
}


