public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		}
	} main {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		}
	} try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		} {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		} java.util.Scanner sc = new java.util.Scanner(System.in) java.util.Scanner sc = new java.util.Scanner(System.in) new java.util.Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc int cnt = 0; cnt 0 while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			} cnt != s.length() cnt s.length() s.length s {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			} if (s.contains(p)) {
					System.out.println("Yes");
					return;
				} s.contains(p) s.contains s p {
					System.out.println("Yes");
					return;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; s = s.substring(1) + s.charAt(0) s s.substring(1) + s.charAt(0) s.substring(1) s.substring s 1 s.charAt(0) s.charAt s 0 cnt++ cnt System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		}
	}
} Main
public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String s = sc.next();
			String p = sc.next();
			int cnt = 0;

			while (cnt != s.length()) {
				if (s.contains(p)) {
					System.out.println("Yes");
					return;
				}

				s = s.substring(1) + s.charAt(0);
				cnt++;
			}

			System.out.println("No");
		}
	}
}
