import java.util.*;


class Main{
    public static void main(String[] args){
    	Scanner sc= new Scanner(System.in);
    String s=sc.nextLine(),p=sc.nextLine();
    char[] l1 = s.toCharArray();
    char[] l2 = p.toCharArray();

   int flag=0;
   for(int i=0;i<s.length();i++){
	   if(flag>=p.length()) break; 	
	if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    }
	   }
   if(flag==0){System.out.println("No");
   }
   else System.out.println("Yes");
	  }
 }
     import java.util.*; util.* java class Main{
    public static void main(String[] args){
    	Scanner sc= new Scanner(System.in);
    String s=sc.nextLine(),p=sc.nextLine();
    char[] l1 = s.toCharArray();
    char[] l2 = p.toCharArray();

   int flag=0;
   for(int i=0;i<s.length();i++){
	   if(flag>=p.length()) break; 	
	if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    }
	   }
   if(flag==0){System.out.println("No");
   }
   else System.out.println("Yes");
	  }
 } Main public static void main(String[] args){
    	Scanner sc= new Scanner(System.in);
    String s=sc.nextLine(),p=sc.nextLine();
    char[] l1 = s.toCharArray();
    char[] l2 = p.toCharArray();

   int flag=0;
   for(int i=0;i<s.length();i++){
	   if(flag>=p.length()) break; 	
	if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    }
	   }
   if(flag==0){System.out.println("No");
   }
   else System.out.println("Yes");
	  } main {
    	Scanner sc= new Scanner(System.in);
    String s=sc.nextLine(),p=sc.nextLine();
    char[] l1 = s.toCharArray();
    char[] l2 = p.toCharArray();

   int flag=0;
   for(int i=0;i<s.length();i++){
	   if(flag>=p.length()) break; 	
	if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    }
	   }
   if(flag==0){System.out.println("No");
   }
   else System.out.println("Yes");
	  } Scanner sc= new Scanner(System.in); sc new Scanner(System.in) String s=sc.nextLine() s sc.nextLine() sc.nextLine sc p=sc.nextLine(); p sc.nextLine() sc.nextLine sc char[] l1 = s.toCharArray(); l1 s.toCharArray() s.toCharArray s char[] l2 = p.toCharArray(); l2 p.toCharArray() p.toCharArray p int flag=0; flag 0 for(int i=0;i<s.length();i++){
	   if(flag>=p.length()) break; 	
	if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    }
	   } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
	   if(flag>=p.length()) break; 	
	if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    }
	   } {
	   if(flag>=p.length()) break; 	
	if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    }
	   } if(flag>=p.length()) break; flag>=p.length() flag p.length() p.length p break; if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    } l1[i]==l2[0] l1[i] l1 i l2[0] l2 0 {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    } int temp=i; temp i for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			} int j=0; int j=0; j 0 j<p.length() j p.length() p.length p j++ j++ j { 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			} { 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			} if(temp==s.length())temp=0; temp==s.length() temp s.length() s.length s temp=0 temp 0 if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			} l2[j]!=l1[temp] l2[j] l2 j l1[temp] l1 temp {
				flag=0;
				break; 
			} flag=0 flag 0 break; temp++ temp flag++ flag if(flag==0){System.out.println("No");
   }
   else System.out.println("Yes"); flag==0 flag 0 {System.out.println("No");
   } System.out.println("No") System.out.println System.out System System.out "No" System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args
import java.util.*;


class Main{
    public static void main(String[] args){
    	Scanner sc= new Scanner(System.in);
    String s=sc.nextLine(),p=sc.nextLine();
    char[] l1 = s.toCharArray();
    char[] l2 = p.toCharArray();

   int flag=0;
   for(int i=0;i<s.length();i++){
	   if(flag>=p.length()) break; 	
	if(l1[i]==l2[0]) {
		int temp=i;
	      for(int j=0;j<p.length();j++){ 
			if(temp==s.length())temp=0;
			if(l2[j]!=l1[temp]){
				flag=0;
				break; 
			}
			temp++;flag++;
			}
	    }
	   }
   if(flag==0){System.out.println("No");
   }
   else System.out.println("Yes");
	  }
 }
    