let () =
  let linein = read_line ()
  and wordin = read_line () in
  let line = linein^linein
  and lenw = String.length wordin
  and lenl = String.length linein in
  let rec check i =
    match i with
      -1 -> "No"
    | i -> if wordin = (String.sub line i lenw) then
             "YES"
           else
             check (i-1)
  in check (lenl-1) |> print_endline;;