#!/usr/bin/env ruby

def figure(s, p)
    if s.include?(p) then
        return true
	end

    i = 0
	loop do
        idx = p[i..-1].index(s[-1]+s[0])
        if idx.nil? then
            break
		end
		idx += i
		if s[-(idx+1)..-1]+s[0, p.size-(idx+1)] == p then
            return true
		end
        i = idx+1
	end
    return false
end

if __FILE__ == $0 then
	s, p = gets.chomp, gets.chomp
	puts figure(s, p) ? 'Yes' : 'No'
end
