import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		printIsString(s, p);
	}

	private static void printIsString(String s, String p) {
		String S = s + s;
		Pattern pa = Pattern.compile(p);
		Matcher m = pa.matcher(S);
		if (m.find()) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} import java.util.Scanner; Scanner java.util import java.util.regex.Matcher; Matcher java.util.regex import java.util.regex.Pattern; Pattern java.util.regex public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		printIsString(s, p);
	}

	private static void printIsString(String s, String p) {
		String S = s + s;
		Pattern pa = Pattern.compile(p);
		Matcher m = pa.matcher(S);
		if (m.find()) {
			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.next();
		String p = sc.next();
		printIsString(s, p);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		printIsString(s, p);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc printIsString(s, p) printIsString s p String[] args args private static void printIsString(String s, String p) {
		String S = s + s;
		Pattern pa = Pattern.compile(p);
		Matcher m = pa.matcher(S);
		if (m.find()) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} printIsString {
		String S = s + s;
		Pattern pa = Pattern.compile(p);
		Matcher m = pa.matcher(S);
		if (m.find()) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} String S = s + s; S s + s s s Pattern pa = Pattern.compile(p); pa Pattern.compile(p) Pattern.compile Pattern p Matcher m = pa.matcher(S); m pa.matcher(S) pa.matcher pa S if (m.find()) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} m.find() m.find m {
			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 s s String p p public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		printIsString(s, p);
	}

	private static void printIsString(String s, String p) {
		String S = s + s;
		Pattern pa = Pattern.compile(p);
		Matcher m = pa.matcher(S);
		if (m.find()) {
			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.next();
		String p = sc.next();
		printIsString(s, p);
	}

	private static void printIsString(String s, String p) {
		String S = s + s;
		Pattern pa = Pattern.compile(p);
		Matcher m = pa.matcher(S);
		if (m.find()) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		printIsString(s, p);
	}

	private static void printIsString(String s, String p) {
		String S = s + s;
		Pattern pa = Pattern.compile(p);
		Matcher m = pa.matcher(S);
		if (m.find()) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}