import java.util.Scanner;

public class Main {
	
	void run() {
		Scanner scan = new Scanner(System.in);
		char[] array1 = scan.next().toCharArray();
		char[] array2 = scan.next().toCharArray();
		outside : for(int i = 0; i < array1.length; i++) {
			if(array1[i] == array2[0]) {
				for(int j = 1; j < array2.length; j++) {
					int tmp = i+j >= array1.length ? i+j-array1.length : i+j;
					if(array2[j] != array1[tmp]) continue outside;
				}
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	
	void run() {
		Scanner scan = new Scanner(System.in);
		char[] array1 = scan.next().toCharArray();
		char[] array2 = scan.next().toCharArray();
		outside : for(int i = 0; i < array1.length; i++) {
			if(array1[i] == array2[0]) {
				for(int j = 1; j < array2.length; j++) {
					int tmp = i+j >= array1.length ? i+j-array1.length : i+j;
					if(array2[j] != array1[tmp]) continue outside;
				}
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main void run() {
		Scanner scan = new Scanner(System.in);
		char[] array1 = scan.next().toCharArray();
		char[] array2 = scan.next().toCharArray();
		outside : for(int i = 0; i < array1.length; i++) {
			if(array1[i] == array2[0]) {
				for(int j = 1; j < array2.length; j++) {
					int tmp = i+j >= array1.length ? i+j-array1.length : i+j;
					if(array2[j] != array1[tmp]) continue outside;
				}
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} run {
		Scanner scan = new Scanner(System.in);
		char[] array1 = scan.next().toCharArray();
		char[] array2 = scan.next().toCharArray();
		outside : for(int i = 0; i < array1.length; i++) {
			if(array1[i] == array2[0]) {
				for(int j = 1; j < array2.length; j++) {
					int tmp = i+j >= array1.length ? i+j-array1.length : i+j;
					if(array2[j] != array1[tmp]) continue outside;
				}
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) char[] array1 = scan.next().toCharArray(); array1 scan.next().toCharArray() scan.next().toCharArray scan.next() scan.next scan char[] array2 = scan.next().toCharArray(); array2 scan.next().toCharArray() scan.next().toCharArray scan.next() scan.next scan System.out.println("No") System.out.println System.out System System.out "No" public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	
	void run() {
		Scanner scan = new Scanner(System.in);
		char[] array1 = scan.next().toCharArray();
		char[] array2 = scan.next().toCharArray();
		outside : for(int i = 0; i < array1.length; i++) {
			if(array1[i] == array2[0]) {
				for(int j = 1; j < array2.length; j++) {
					int tmp = i+j >= array1.length ? i+j-array1.length : i+j;
					if(array2[j] != array1[tmp]) continue outside;
				}
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	
	void run() {
		Scanner scan = new Scanner(System.in);
		char[] array1 = scan.next().toCharArray();
		char[] array2 = scan.next().toCharArray();
		outside : for(int i = 0; i < array1.length; i++) {
			if(array1[i] == array2[0]) {
				for(int j = 1; j < array2.length; j++) {
					int tmp = i+j >= array1.length ? i+j-array1.length : i+j;
					if(array2[j] != array1[tmp]) continue outside;
				}
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Scanner;

public class Main {
	
	void run() {
		Scanner scan = new Scanner(System.in);
		char[] array1 = scan.next().toCharArray();
		char[] array2 = scan.next().toCharArray();
		outside : for(int i = 0; i < array1.length; i++) {
			if(array1[i] == array2[0]) {
				for(int j = 1; j < array2.length; j++) {
					int tmp = i+j >= array1.length ? i+j-array1.length : i+j;
					if(array2[j] != array1[tmp]) continue outside;
				}
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
}
