s = gets.chomp
p = gets.chomp
ls = s.length
lp = p.length
judge = false
for i in 1..ls
  if ls - i + 1 >= lp
    t = s[i-1,lp]
  else
    lt = ls - i + 1
    t = s[i-1,lt] + s[0,lp-lt]
  end
  judge = true if t == p
end
if judge
  puts "Yes"
else
  puts "No"
end