def contains(ring, p)
  length = ring.length
  p_length = p.length
  ring_array = substrings(ring, p_length)
  for i in 0..length-1
    if ring_array[i] == p
      return true
    end
  end
end

def substrings(ring, len)
  array_size = ring.length
  ring = ring + ring
  output = []
  for i in 0..(array_size-1)
    substring = ring[i..i+len-1]
    output.push(substring)
  end
  return output
end

ring = gets.chomp
p = gets.chomp
if contains(ring, p) == true
  puts "Yes"
else
  puts "No"
end