import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String p = sc.nextLine();

		int sLen = s.length();
		int pLen = p.length();
		boolean ok = false;
		for (int i = 0; i < sLen; i++) {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		}

		System.out.println(ok ? "Yes" : "No");

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String p = sc.nextLine();

		int sLen = s.length();
		int pLen = p.length();
		boolean ok = false;
		for (int i = 0; i < sLen; i++) {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		}

		System.out.println(ok ? "Yes" : "No");

	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String p = sc.nextLine();

		int sLen = s.length();
		int pLen = p.length();
		boolean ok = false;
		for (int i = 0; i < sLen; i++) {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		}

		System.out.println(ok ? "Yes" : "No");

	} main {

		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String p = sc.nextLine();

		int sLen = s.length();
		int pLen = p.length();
		boolean ok = false;
		for (int i = 0; i < sLen; i++) {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		}

		System.out.println(ok ? "Yes" : "No");

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc int sLen = s.length(); sLen s.length() s.length s int pLen = p.length(); pLen p.length() p.length p boolean ok = false; ok false for (int i = 0; i < sLen; i++) {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		} int i = 0; int i = 0; i 0 i < sLen i sLen i++ i++ i {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		} {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		} for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			} int j = 0; int j = 0; j 0 j < pLen j pLen j++ j++ j {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			} {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			} if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				} s.charAt((i + j)%sLen) != p.charAt(j) s.charAt((i + j)%sLen) s.charAt s (i + j)%sLen (i + j) i j sLen p.charAt(j) p.charAt p j {
					break;
				} break; if(j == pLen-1) ok = true; j == pLen-1 j pLen-1 pLen 1 ok = true ok true if(ok) break; ok break; System.out.println(ok ? "Yes" : "No") System.out.println System.out System System.out ok ? "Yes" : "No" ok "Yes" "No" String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String p = sc.nextLine();

		int sLen = s.length();
		int pLen = p.length();
		boolean ok = false;
		for (int i = 0; i < sLen; i++) {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		}

		System.out.println(ok ? "Yes" : "No");

	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String p = sc.nextLine();

		int sLen = s.length();
		int pLen = p.length();
		boolean ok = false;
		for (int i = 0; i < sLen; i++) {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		}

		System.out.println(ok ? "Yes" : "No");

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String p = sc.nextLine();

		int sLen = s.length();
		int pLen = p.length();
		boolean ok = false;
		for (int i = 0; i < sLen; i++) {

			for (int j = 0; j < pLen; j++) {

				if(s.charAt((i + j)%sLen) != p.charAt(j)) {
					break;
				}

				if(j == pLen-1) ok = true;

			}

			if(ok) break;

		}

		System.out.println(ok ? "Yes" : "No");

	}
}