
s = gets.chomp
p = gets.chomp

n = 0
s.each_char do |i|
    k = s[n,s.size].index(p[0])
    if !k then
        break
    end
    n += k
    
    if (s[n,s.size] + s[0, n]).index(p) then
        print "Yes\n"
        exit
    end
    
    n += 1
end

print "No\n"

