let rec hoge s (t : string) n =
    if n = 0 then printfn "No"
    elif s = t then printfn "Yes"
    else hoge s (t.Substring(t.Length) + t.Substring(0, t.Length - 1)) (n - 1)
let s = stdin.ReadLine()
let t = stdin.ReadLine()
hoge s t (s.Length)