import java.util.Scanner;                      


class Main {



	public static void main(String[] args) {   

		Scanner scanner = new Scanner(System.in);


			String s= scanner.nextLine();//文字列sの入力
			String p= scanner.nextLine();//文字列pの入力
			
		
			char[] chars; 
			chars=new char[s.length()];//文字列sを格納する配列chars
			String[] Strings;
			Strings=new String[s.length()];
			String compare="";//文字列pと比較する変数
			boolean anther =false; 
			
			for(int i=0;i < s.length();i++){//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			}

			int loop=0;//ループを制御する変数
			for(int i =0;i<s.length();i++){
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			}
				if(anther){
					System.out.println("Yes");
				}
				
				else{
					System.out.println("No");
				}


		scanner.close();


	}
}
 import java.util.Scanner; Scanner java.util class Main {



	public static void main(String[] args) {   

		Scanner scanner = new Scanner(System.in);


			String s= scanner.nextLine();//文字列sの入力
			String p= scanner.nextLine();//文字列pの入力
			
		
			char[] chars; 
			chars=new char[s.length()];//文字列sを格納する配列chars
			String[] Strings;
			Strings=new String[s.length()];
			String compare="";//文字列pと比較する変数
			boolean anther =false; 
			
			for(int i=0;i < s.length();i++){//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			}

			int loop=0;//ループを制御する変数
			for(int i =0;i<s.length();i++){
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			}
				if(anther){
					System.out.println("Yes");
				}
				
				else{
					System.out.println("No");
				}


		scanner.close();


	}
} Main public static void main(String[] args) {   

		Scanner scanner = new Scanner(System.in);


			String s= scanner.nextLine();//文字列sの入力
			String p= scanner.nextLine();//文字列pの入力
			
		
			char[] chars; 
			chars=new char[s.length()];//文字列sを格納する配列chars
			String[] Strings;
			Strings=new String[s.length()];
			String compare="";//文字列pと比較する変数
			boolean anther =false; 
			
			for(int i=0;i < s.length();i++){//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			}

			int loop=0;//ループを制御する変数
			for(int i =0;i<s.length();i++){
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			}
				if(anther){
					System.out.println("Yes");
				}
				
				else{
					System.out.println("No");
				}


		scanner.close();


	} main {   

		Scanner scanner = new Scanner(System.in);


			String s= scanner.nextLine();//文字列sの入力
			String p= scanner.nextLine();//文字列pの入力
			
		
			char[] chars; 
			chars=new char[s.length()];//文字列sを格納する配列chars
			String[] Strings;
			Strings=new String[s.length()];
			String compare="";//文字列pと比較する変数
			boolean anther =false; 
			
			for(int i=0;i < s.length();i++){//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			}

			int loop=0;//ループを制御する変数
			for(int i =0;i<s.length();i++){
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			}
				if(anther){
					System.out.println("Yes");
				}
				
				else{
					System.out.println("No");
				}


		scanner.close();


	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s= scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner String p= scanner.nextLine(); p scanner.nextLine() scanner.nextLine scanner char[] chars; chars chars=new char[s.length()] chars new char[s.length()] s.length() s.length s String[] Strings; Strings Strings=new String[s.length()] Strings new String[s.length()] s.length() s.length s String compare=""; compare "" boolean anther =false; anther false for(int i=0;i < s.length();i++){//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			} int i=0; int i=0; i 0 i < s.length() i s.length() s.length s i++ i++ i {//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			} {//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			} chars[i]=s.charAt(i) chars[i] chars i s.charAt(i) s.charAt s i Strings[i]=String.valueOf(chars[i]) Strings[i] Strings i String.valueOf(chars[i]) String.valueOf String chars[i] chars i int loop=0; loop 0 for(int i =0;i<s.length();i++){
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			} int i =0; int i =0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			} {
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			} loop=i loop i for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				} int ii=i; int ii=i; ii i ii<p.length()+i ii p.length()+i p.length() p.length p i ii++ ii++ ii {
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				} {
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				} if(loop == s.length()){
					loop=0;
				} loop == s.length() loop s.length() s.length s {
					loop=0;
				} loop=0 loop 0 compare = compare.concat(Strings[loop]) compare compare.concat(Strings[loop]) compare.concat compare Strings[loop] Strings loop loop=loop+1 loop loop+1 loop 1 if(compare.equals(p)){
					anther=true;
				} compare.equals(p) compare.equals compare p {
					anther=true;
				} anther=true anther true compare="" compare "" if(anther){
					System.out.println("Yes");
				}
				
				else{
					System.out.println("No");
				} anther {
					System.out.println("Yes");
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
					System.out.println("No");
				} System.out.println("No") System.out.println System.out System System.out "No" scanner.close() scanner.close scanner String[] args args
import java.util.Scanner;                      


class Main {



	public static void main(String[] args) {   

		Scanner scanner = new Scanner(System.in);


			String s= scanner.nextLine();//文字列sの入力
			String p= scanner.nextLine();//文字列pの入力
			
		
			char[] chars; 
			chars=new char[s.length()];//文字列sを格納する配列chars
			String[] Strings;
			Strings=new String[s.length()];
			String compare="";//文字列pと比較する変数
			boolean anther =false; 
			
			for(int i=0;i < s.length();i++){//桁数分くりかえす
				chars[i]=s.charAt(i);//文字列を1文字ずつ配列に格納
				Strings[i]=String.valueOf(chars[i]);//String型に変換
			}

			int loop=0;//ループを制御する変数
			for(int i =0;i<s.length();i++){
				loop=i;
			for(int ii=i;ii<p.length()+i;ii++){
				 
				
				if(loop == s.length()){
					loop=0;
				}
				
				compare = compare.concat(Strings[loop]);	
				
				loop=loop+1;
				
				if(compare.equals(p)){
					anther=true;
				}
				
				}
			compare="";
			}
				if(anther){
					System.out.println("Yes");
				}
				
				else{
					System.out.println("No");
				}


		scanner.close();


	}
}

