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();
		s = s + s;
		int pLen = p.length();
		int sLen = s.length();
		int pPoint = 0;
		int sPoint = 0;
		while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		}
		if (pPoint == pLen) {
			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);
		String s = sc.nextLine();
		String p = sc.nextLine();
		s = s + s;
		int pLen = p.length();
		int sLen = s.length();
		int pPoint = 0;
		int sPoint = 0;
		while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		}
		if (pPoint == pLen) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		s = s + s;
		int pLen = p.length();
		int sLen = s.length();
		int pPoint = 0;
		int sPoint = 0;
		while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		}
		if (pPoint == pLen) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		s = s + s;
		int pLen = p.length();
		int sLen = s.length();
		int pPoint = 0;
		int sPoint = 0;
		while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		}
		if (pPoint == pLen) {
			System.out.println("Yes");
		} else {
			System.out.println("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 s = s + s s s + s s s int pLen = p.length(); pLen p.length() p.length p int sLen = s.length(); sLen s.length() s.length s int pPoint = 0; pPoint 0 int sPoint = 0; sPoint 0 while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		} sPoint < sLen && pPoint < pLen sPoint < sLen sPoint sLen pPoint < pLen pPoint pLen {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		} if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			} s.charAt(sPoint) == p.charAt(pPoint) s.charAt(sPoint) s.charAt s sPoint p.charAt(pPoint) p.charAt p pPoint {
				sPoint++;
				pPoint++;
			} sPoint++ sPoint pPoint++ pPoint {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			} sPoint = sPoint - pPoint + 1 sPoint sPoint - pPoint + 1 sPoint - pPoint sPoint pPoint 1 pPoint = 0 pPoint 0 if (pPoint == pLen) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} pPoint == pLen pPoint pLen {
			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" 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();
		s = s + s;
		int pLen = p.length();
		int sLen = s.length();
		int pPoint = 0;
		int sPoint = 0;
		while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		}
		if (pPoint == pLen) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		s = s + s;
		int pLen = p.length();
		int sLen = s.length();
		int pPoint = 0;
		int sPoint = 0;
		while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		}
		if (pPoint == pLen) {
			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);
		String s = sc.nextLine();
		String p = sc.nextLine();
		s = s + s;
		int pLen = p.length();
		int sLen = s.length();
		int pPoint = 0;
		int sPoint = 0;
		while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		}
		if (pPoint == pLen) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}
