open System


[<EntryPoint>]
let main argv =
    let s =stdin.ReadLine()
    let l =String.length s
    let t =stdin.ReadLine()
    [|for i in [1..(l-1)] do yield (s.Substring(i)+s.Substring(0,i));yield s|]
    |>Seq.sumBy(fun c -> (if c=t then 1 else 0))
    |>fun c -> (if c>0 then "Yes" else "No")
    |>stdout.WriteLine
    0