import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		char[] s = sc.next().toCharArray();
		char[] p = sc.next().toCharArray();
		
		boolean flag = false;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		char[] s = sc.next().toCharArray();
		char[] p = sc.next().toCharArray();
		
		boolean flag = false;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

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

		char[] s = sc.next().toCharArray();
		char[] p = sc.next().toCharArray();
		
		boolean flag = false;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in); 

		char[] s = sc.next().toCharArray();
		char[] p = sc.next().toCharArray();
		
		boolean flag = false;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] p = sc.next().toCharArray(); p sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc boolean flag = false; flag false for (int i = 0; i < s.length; i++) {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		} {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		} if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			} s[i] == p[0] s[i] s i p[0] p 0 {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			} flag = true flag true for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				} int j = 0; int j = 0; j 0 j < p.length j p.length p p.length j++ j++ j {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				} {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				} if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					} s[(i + j) % s.length] != p[j] s[(i + j) % s.length] s (i + j) % s.length (i + j) i j s.length s s.length p[j] p j {
						flag = false;
						break;
					} flag = false flag false break; if (flag) {
					break;
				} flag {
					break;
				} break; if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} flag {
			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" sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		char[] s = sc.next().toCharArray();
		char[] p = sc.next().toCharArray();
		
		boolean flag = false;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		char[] s = sc.next().toCharArray();
		char[] p = sc.next().toCharArray();
		
		boolean flag = false;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
} Main
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		char[] s = sc.next().toCharArray();
		char[] p = sc.next().toCharArray();
		
		boolean flag = false;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == p[0]) {
				flag = true;
				for (int j = 0; j < p.length; j++) {
					if (s[(i + j) % s.length] != p[j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
}