import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str=new String();
		String p = new String();

		 str = scan.nextLine();
		 p =  scan.nextLine();
		 str = str+str;
				
				if(str.lastIndexOf(p)==-1){
					System.out.println("No");
				}else{
					System.out.println("Yes");
				}

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str=new String();
		String p = new String();

		 str = scan.nextLine();
		 p =  scan.nextLine();
		 str = str+str;
				
				if(str.lastIndexOf(p)==-1){
					System.out.println("No");
				}else{
					System.out.println("Yes");
				}

	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str=new String();
		String p = new String();

		 str = scan.nextLine();
		 p =  scan.nextLine();
		 str = str+str;
				
				if(str.lastIndexOf(p)==-1){
					System.out.println("No");
				}else{
					System.out.println("Yes");
				}

	} main {
		Scanner scan = new Scanner(System.in);
		String str=new String();
		String p = new String();

		 str = scan.nextLine();
		 p =  scan.nextLine();
		 str = str+str;
				
				if(str.lastIndexOf(p)==-1){
					System.out.println("No");
				}else{
					System.out.println("Yes");
				}

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str=new String(); str new String() String p = new String(); p new String() str = scan.nextLine() str scan.nextLine() scan.nextLine scan p =  scan.nextLine() p scan.nextLine() scan.nextLine scan str = str+str str str+str str str if(str.lastIndexOf(p)==-1){
					System.out.println("No");
				}else{
					System.out.println("Yes");
				} str.lastIndexOf(p)==-1 str.lastIndexOf(p) str.lastIndexOf str p -1 1 {
					System.out.println("No");
				} System.out.println("No") System.out.println System.out System System.out "No" {
					System.out.println("Yes");
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str=new String();
		String p = new String();

		 str = scan.nextLine();
		 p =  scan.nextLine();
		 str = str+str;
				
				if(str.lastIndexOf(p)==-1){
					System.out.println("No");
				}else{
					System.out.println("Yes");
				}

	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str=new String();
		String p = new String();

		 str = scan.nextLine();
		 p =  scan.nextLine();
		 str = str+str;
				
				if(str.lastIndexOf(p)==-1){
					System.out.println("No");
				}else{
					System.out.println("Yes");
				}

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str=new String();
		String p = new String();

		 str = scan.nextLine();
		 p =  scan.nextLine();
		 str = str+str;
				
				if(str.lastIndexOf(p)==-1){
					System.out.println("No");
				}else{
					System.out.println("Yes");
				}

	}
}