import java.util.Scanner;

public class Main {

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

		char[] s = sc.nextLine().toCharArray();
		char[] p = sc.nextLine().toCharArray();

		boolean flag = false;

		for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		}

		Print(flag);

	}

	static boolean seretch(char[] s, char[] p) {
		for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		}
		return false;

	}

	static char[] MoveCharRing(char[] c) {
		char work = c[0];
		for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		}
		c[c.length - 1] = work;
		return c;
	}

	static void Print(boolean f) {
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}
 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.nextLine().toCharArray();
		char[] p = sc.nextLine().toCharArray();

		boolean flag = false;

		for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		}

		Print(flag);

	}

	static boolean seretch(char[] s, char[] p) {
		for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		}
		return false;

	}

	static char[] MoveCharRing(char[] c) {
		char work = c[0];
		for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		}
		c[c.length - 1] = work;
		return c;
	}

	static void Print(boolean f) {
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

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

		char[] s = sc.nextLine().toCharArray();
		char[] p = sc.nextLine().toCharArray();

		boolean flag = false;

		for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		}

		Print(flag);

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

		char[] s = sc.nextLine().toCharArray();
		char[] p = sc.nextLine().toCharArray();

		boolean flag = false;

		for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		}

		Print(flag);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.nextLine().toCharArray(); s sc.nextLine().toCharArray() sc.nextLine().toCharArray sc.nextLine() sc.nextLine sc char[] p = sc.nextLine().toCharArray(); p sc.nextLine().toCharArray() sc.nextLine().toCharArray sc.nextLine() sc.nextLine sc boolean flag = false; flag false for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		} {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		} if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			} seretch(s, p) seretch s p {
				flag = true;
				break;
			} flag = true flag true break; {
				s = MoveCharRing(s);
			} s = MoveCharRing(s) s MoveCharRing(s) MoveCharRing s Print(flag) Print flag String[] args args static boolean seretch(char[] s, char[] p) {
		for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		}
		return false;

	} seretch {
		for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		}
		return false;

	} for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		} int si = 0; int si = 0; si 0 si + p.length <= s.length si + p.length si p.length p p.length s.length s s.length si++ si++ si {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		} {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		} int i = 0; i 0 if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			} s[si] == p[0] s[si] s si p[0] p 0 {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			} for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				} i = 1; i = 1 i 1 i < p.length i p.length p p.length i++ i++ i {
					if (s[si + i] != p[i]) {
						break;
					}
				} {
					if (s[si + i] != p[i]) {
						break;
					}
				} if (s[si + i] != p[i]) {
						break;
					} s[si + i] != p[i] s[si + i] s si + i si i p[i] p i {
						break;
					} break; if (i == p.length) {
					return true;
				} i == p.length i p.length p p.length {
					return true;
				} return true; true return false; false char[] s s char[] p p static char[] MoveCharRing(char[] c) {
		char work = c[0];
		for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		}
		c[c.length - 1] = work;
		return c;
	} MoveCharRing {
		char work = c[0];
		for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		}
		c[c.length - 1] = work;
		return c;
	} char work = c[0]; work c[0] c 0 for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		} int i = 1; int i = 1; i 1 i < c.length i c.length c c.length i++ i++ i {
			c[i - 1] = c[i];
		} {
			c[i - 1] = c[i];
		} c[i - 1] = c[i] c[i - 1] c i - 1 i 1 c[i] c i c[c.length - 1] = work c[c.length - 1] c c.length - 1 c.length c c.length 1 work return c; c char[] c c static void Print(boolean f) {
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Print {
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} f {
			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" boolean f f public class Main {

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

		char[] s = sc.nextLine().toCharArray();
		char[] p = sc.nextLine().toCharArray();

		boolean flag = false;

		for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		}

		Print(flag);

	}

	static boolean seretch(char[] s, char[] p) {
		for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		}
		return false;

	}

	static char[] MoveCharRing(char[] c) {
		char work = c[0];
		for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		}
		c[c.length - 1] = work;
		return c;
	}

	static void Print(boolean f) {
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} public class Main {

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

		char[] s = sc.nextLine().toCharArray();
		char[] p = sc.nextLine().toCharArray();

		boolean flag = false;

		for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		}

		Print(flag);

	}

	static boolean seretch(char[] s, char[] p) {
		for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		}
		return false;

	}

	static char[] MoveCharRing(char[] c) {
		char work = c[0];
		for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		}
		c[c.length - 1] = work;
		return c;
	}

	static void Print(boolean f) {
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} Main
import java.util.Scanner;

public class Main {

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

		char[] s = sc.nextLine().toCharArray();
		char[] p = sc.nextLine().toCharArray();

		boolean flag = false;

		for (int i = 0; i < s.length; i++) {
			if (seretch(s, p)) {
				flag = true;
				break;
			} else {
				s = MoveCharRing(s);
			}
		}

		Print(flag);

	}

	static boolean seretch(char[] s, char[] p) {
		for (int si = 0; si + p.length <= s.length; si++) {
			int i = 0;
			if (s[si] == p[0]) {
				for (i = 1; i < p.length; i++) {
					if (s[si + i] != p[i]) {
						break;
					}
				}
				// System.out.println(i);
				if (i == p.length) {
					return true;
				}
			}
		}
		return false;

	}

	static char[] MoveCharRing(char[] c) {
		char work = c[0];
		for (int i = 1; i < c.length; i++) {
			c[i - 1] = c[i];
		}
		c[c.length - 1] = work;
		return c;
	}

	static void Print(boolean f) {
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

