let s = stdin.ReadLine() |> Seq.toList
let t = stdin.ReadLine() |> Seq.toList

let rec rotate k xs =
    match (k, xs) with
        |_, [] -> []
        |0, xs -> xs
        |k, x::xs -> rotate (k-1) (xs @ [x])

seq { 1..(List.length s) }
|> Seq.tryFind (fun i -> t = (rotate i s))
|> function | Some _ -> "Yes" | None -> "No"
|> printfn "%s"