def main
    circle = gets.chomp
    pattern = gets.chomp
    start_index_candidate = []
    circle.size.times do |index|
        if circle[index] == pattern[0]
            start_index_candidate.push(index)
        end
    end
    circle += circle
    start_index_candidate.each do |index|
        if circle.slice(index..index+pattern.size-1) == pattern
            puts "Yes"
            return
        end
    end
    puts "No"
    return
end

main()
