s = gets.chomp
p = gets.chomp
s = s + s
ok = false

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