ring = gets.chomp.split(//)
ring = ring * 2
str = gets.chomp
i = 0
bool = false
while i < ring.length / 2 and !bool
  bool = (ring[i, str.length].join == str)
  i += 1
end
if bool
  puts "Yes"
else
  puts "No"
end