s, p = STDIN.read.split("\n")
s.size.times do |i|
  if s[i] == p[0]
    j = i
    ok = true
    p.size.times do |k|
      if s[j] != p[k]
        ok = false
        break
      end
      j = (j + 1) % s.size
    end
    if ok
      puts "Yes"
      exit
    end
  end
end
puts "No"