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