(* O(|s|^2) *)
let s = read_line ()
let t = read_line ()
let n = String.length s
let rotate s = String.make 1 s.[n - 1] ^ String.sub s 0 (n - 1)
let s' = ref s
let _ =
  for i = 1 to n do if !s' = t then (print_endline "Yes"; exit 0); s' := rotate !s' done;
  print_endline "No"