s = gets.chomp
p = gets.chomp

result = 'No'

if s.match(/#{p}/)
  result = 'Yes'
else
  i = 1
  while i < s.length
    if s.match(/#{p[i..-1]}/) && s[(-1*i)..-1] == p[0..(i-1)]
      result = 'Yes'
      break
    end
    i += 1
  end
end

puts result