import java.util.*;

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

		Scanner scan = new Scanner(System.in);
		String first = scan.nextLine();
		String fRep = first + first;
		String second = scan.nextLine();
		boolean flg = false;

		for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		}
		System.out.println((flg)? "Yes" : "No");
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		String first = scan.nextLine();
		String fRep = first + first;
		String second = scan.nextLine();
		boolean flg = false;

		for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		}
		System.out.println((flg)? "Yes" : "No");
	}
} Main public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		String first = scan.nextLine();
		String fRep = first + first;
		String second = scan.nextLine();
		boolean flg = false;

		for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		}
		System.out.println((flg)? "Yes" : "No");
	} main {

		Scanner scan = new Scanner(System.in);
		String first = scan.nextLine();
		String fRep = first + first;
		String second = scan.nextLine();
		boolean flg = false;

		for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		}
		System.out.println((flg)? "Yes" : "No");
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String first = scan.nextLine(); first scan.nextLine() scan.nextLine scan String fRep = first + first; fRep first + first first first String second = scan.nextLine(); second scan.nextLine() scan.nextLine scan boolean flg = false; flg false for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		} int i = 0; int i = 0; i 0 i < fRep.length() - second.length() i fRep.length() - second.length() fRep.length() fRep.length fRep second.length() second.length second i++ i++ i {
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		} {
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		} String subF = fRep.substring(i, i + second.length()); subF fRep.substring(i, i + second.length()) fRep.substring fRep i i + second.length() i second.length() second.length second if(subF.equals(second)){
				flg = true;
				break;
			} subF.equals(second) subF.equals subF second {
				flg = true;
				break;
			} flg = true flg true break; System.out.println((flg)? "Yes" : "No") System.out.println System.out System System.out (flg)? "Yes" : "No" (flg) "Yes" "No" String[] args args public class Main{
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		String first = scan.nextLine();
		String fRep = first + first;
		String second = scan.nextLine();
		boolean flg = false;

		for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		}
		System.out.println((flg)? "Yes" : "No");
	}
} public class Main{
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		String first = scan.nextLine();
		String fRep = first + first;
		String second = scan.nextLine();
		boolean flg = false;

		for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		}
		System.out.println((flg)? "Yes" : "No");
	}
} Main
import java.util.*;

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

		Scanner scan = new Scanner(System.in);
		String first = scan.nextLine();
		String fRep = first + first;
		String second = scan.nextLine();
		boolean flg = false;

		for(int i = 0; i < fRep.length() - second.length(); i++){
			String subF = fRep.substring(i, i + second.length());
			if(subF.equals(second)){
				flg = true;
				break;
			}
		}
		System.out.println((flg)? "Yes" : "No");
	}
}