ok = false
s = gets.chomp
ss =s+s
p = gets.chomp
for i in 0..(s.length-1)
for j in 0..(p.length-1)
if ss[i+j]  != p[j]
break
end
if j == p.length
ok=true
end
end
if ok == true
puts "Yes"
else
puts "No"