(* O(|s|^2) *)
let s = read_line ()
let t = read_line ()
let n = String.length s
let s2 = s ^ s
let _ =
  for i = 0 to n - 1 do if String.sub s2 i n = t then (print_endline "Yes"; exit 0) done;
  print_endline "No"