import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		String q = in.next();

		int i;
		int ret = -1;
		for (i = 0; i < s.length(); i++) {
			if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			}
		}
		if (ret == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		String q = in.next();

		int i;
		int ret = -1;
		for (i = 0; i < s.length(); i++) {
			if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			}
		}
		if (ret == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		String q = in.next();

		int i;
		int ret = -1;
		for (i = 0; i < s.length(); i++) {
			if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			}
		}
		if (ret == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	} main {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		String q = in.next();

		int i;
		int ret = -1;
		for (i = 0; i < s.length(); i++) {
			if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			}
		}
		if (ret == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in String q = in.next(); q in.next() in.next in int i; i int ret = -1; ret -1 1 for (i = 0; i < s.length(); i++) {
			if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			}
		} i = 0; i = 0 i 0 i < s.length() i s.length() s.length s i++ i++ i {
			if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			}
		} {
			if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			}
		} if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			} s.indexOf(q) == -1 s.indexOf(q) s.indexOf s q -1 1 {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} s = s.substring(1, s.length()) + s.substring(0, 1) s s.substring(1, s.length()) + s.substring(0, 1) s.substring(1, s.length()) s.substring s 1 s.length() s.length s s.substring(0, 1) s.substring s 0 1 {
				ret = s.indexOf(q);
				break;
			} ret = s.indexOf(q) ret s.indexOf(q) s.indexOf s q break; if (ret == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		} ret == -1 ret -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
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		String q = in.next();

		int i;
		int ret = -1;
		for (i = 0; i < s.length(); i++) {
			if (s.indexOf(q) == -1) {
				s = s.substring(1, s.length()) + s.substring(0, 1);
			} else {
				ret = s.indexOf(q);
				break;
			}
		}
		if (ret == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}