import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine();
		String p = scan.nextLine();
		scan.close();
		
		String ss = s + s;
		
		String strJudge = null;
		boolean isYes = false;
		for(int i = 0; i < ss.length(); i++){
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		}
		if(!isYes){
			System.out.println("No");
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine();
		String p = scan.nextLine();
		scan.close();
		
		String ss = s + s;
		
		String strJudge = null;
		boolean isYes = false;
		for(int i = 0; i < ss.length(); i++){
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		}
		if(!isYes){
			System.out.println("No");
		}
	}

} Main public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine();
		String p = scan.nextLine();
		scan.close();
		
		String ss = s + s;
		
		String strJudge = null;
		boolean isYes = false;
		for(int i = 0; i < ss.length(); i++){
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		}
		if(!isYes){
			System.out.println("No");
		}
	} main {
		
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine();
		String p = scan.nextLine();
		scan.close();
		
		String ss = s + s;
		
		String strJudge = null;
		boolean isYes = false;
		for(int i = 0; i < ss.length(); i++){
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		}
		if(!isYes){
			System.out.println("No");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan String p = scan.nextLine(); p scan.nextLine() scan.nextLine scan scan.close() scan.close scan String ss = s + s; ss s + s s s String strJudge = null; strJudge null boolean isYes = false; isYes false for(int i = 0; i < ss.length(); i++){
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		} int i = 0; int i = 0; i 0 i < ss.length() i ss.length() ss.length ss i++ i++ i {
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		} {
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		} if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			} p.length() < ss.length()  - i p.length() p.length p ss.length()  - i ss.length() ss.length ss i {
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			} strJudge = ss.substring(i, i + p.length()) strJudge ss.substring(i, i + p.length()) ss.substring ss i i + p.length() i p.length() p.length p if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			} p.equals(strJudge) p.equals p strJudge {
				System.out.println("Yes");
				isYes = true;
				break;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" isYes = true isYes true break; if(!isYes){
			System.out.println("No");
		} !isYes isYes {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
	
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine();
		String p = scan.nextLine();
		scan.close();
		
		String ss = s + s;
		
		String strJudge = null;
		boolean isYes = false;
		for(int i = 0; i < ss.length(); i++){
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		}
		if(!isYes){
			System.out.println("No");
		}
	}

} public class Main {
	
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine();
		String p = scan.nextLine();
		scan.close();
		
		String ss = s + s;
		
		String strJudge = null;
		boolean isYes = false;
		for(int i = 0; i < ss.length(); i++){
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		}
		if(!isYes){
			System.out.println("No");
		}
	}

} Main
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine();
		String p = scan.nextLine();
		scan.close();
		
		String ss = s + s;
		
		String strJudge = null;
		boolean isYes = false;
		for(int i = 0; i < ss.length(); i++){
			
			if(p.length() < ss.length()  - i){
				strJudge = ss.substring(i, i + p.length());
				//System.out.println(i + ":strJudge:" + strJudge);
			}
			
			if(p.equals(strJudge)){
				System.out.println("Yes");
				isYes = true;
				break;
			}			
		}
		if(!isYes){
			System.out.println("No");
		}
	}

}