let () =
  let s = read_line () in
  let t = read_line () in
  Array.init (String.length s) (fun i -> i)
  |> Array.to_list
  |> List.exists (fun i ->
      Array.init (String.length s) (fun j -> j)
      |> Array.to_list
      |> List.for_all (fun j ->
          s.[(i + j) mod String.length s] = t.[j]))
  |> (function true -> "Yes" | false -> "No")
  |> print_endline
