#!/usr/bin/env ruby

string = gets.chomp * 2
word = gets.chomp
0.upto(string.length-word.length) do |index|
    hoge = string.slice(index,word.length)
    if hoge == word then
        puts "Yes"
        exit
   end
end
puts "No"
