#!/usr/bin/env ruby

strings = gets.split
string = strings[1] * 2

0.upto(string.length-strings[0].length) do |index|
    hoge = strings[1].slice(index,string.length)
    if hoge == strings[0] then
        puts "Yes"
        exit
    end
end
puts "No"
