let quick_search str pat =
  let n_str = String.length str in
  let n_pat = String.length pat in
  let tbl = Array.init 256 (fun _ -> n_pat + 1) in
  String.iteri (fun i c -> tbl.(Char.code c) <- n_pat - i) pat;
  let rec doit i =
    if i >= (n_str - n_pat) then None
    else
      let rec scan i j =
        if String.get str (i + j) <> String.get pat j then None
        else if j = (n_pat - 1) then Some i
        else scan i (j + 1)
      in
      match scan i 0 with
      | None -> doit (i + tbl.(Char.code (String.get str (i + n_pat))))
      | ret -> ret
  in
  doit 0

let () =
  let s = read_line () in
  let l = read_line () in
  match quick_search (s^s) l with
  | None -> Printf.printf "No\n"
  | Some _ -> Printf.printf "Yes\n"