#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
def main
  dat=[]
  fh=STDIN
  #fh=File.new("x.txt", "r")
  txt = fh.gets.chomp
  str = fh.gets.chomp
  re=Regexp.new(/#{str}/)
  txt2 = txt + txt
  if re.match(txt2)
    puts "Yes"
  else
    puts "No"
  end

end

if $0 == __FILE__ then
  main
end
