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 i = ref 0 in
  try
    while !i < (n_str - n_pat) do
      let j = ref 0 in
      while String.get str (!i + !j) = String.get pat !j do
        if !j = (n_pat - 1) then raise Exit;
        incr j;
      done;
      i := !i + tbl.(Char.code (String.get str (!i + n_pat)));
    done;
    None
  with Exit -> Some !i

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"