program answer
  implicit none

  character(len=100):: S, T, U
  integer :: i, j, a

  read(*,*) S
  read(*,*) T

  a=len_trim(S)
  
  
  do i = 1, a
     if(S==t) then
        write(*,*) 'Yes'
        stop
     end if
     U=S
     do j = 1, a-1
        S(j+1:j+1)=U(j:j)
     end do
     S(1:1)=U(a:a)
  end do
     
     write(*,*) 'No'     

  stop
 end program answer
