import java.util.*;
import java.io.*;

class Main {
	static PrintStream out = System.out;
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		String s = in.nextLine().trim();
		String p = in.nextLine().trim();
		s += s;
		if (s.indexOf(p) < 0) {
			out.println("No");
		} else {
			out.println("Yes");
		}
	}
} import java.util.*; util.* java import java.io.*; io.* java class Main {
	static PrintStream out = System.out;
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		String s = in.nextLine().trim();
		String p = in.nextLine().trim();
		s += s;
		if (s.indexOf(p) < 0) {
			out.println("No");
		} else {
			out.println("Yes");
		}
	}
} Main static PrintStream out = System.out; out System.out System System.out static Scanner in = new Scanner(System.in); in new Scanner(System.in) public static void main(String[] args) {
		String s = in.nextLine().trim();
		String p = in.nextLine().trim();
		s += s;
		if (s.indexOf(p) < 0) {
			out.println("No");
		} else {
			out.println("Yes");
		}
	} main {
		String s = in.nextLine().trim();
		String p = in.nextLine().trim();
		s += s;
		if (s.indexOf(p) < 0) {
			out.println("No");
		} else {
			out.println("Yes");
		}
	} String s = in.nextLine().trim(); s in.nextLine().trim() in.nextLine().trim in.nextLine() in.nextLine in String p = in.nextLine().trim(); p in.nextLine().trim() in.nextLine().trim in.nextLine() in.nextLine in s += s s s if (s.indexOf(p) < 0) {
			out.println("No");
		} else {
			out.println("Yes");
		} s.indexOf(p) < 0 s.indexOf(p) s.indexOf s p 0 {
			out.println("No");
		} out.println("No") out.println out "No" {
			out.println("Yes");
		} out.println("Yes") out.println out "Yes" String[] args args
import java.util.*;
import java.io.*;

class Main {
	static PrintStream out = System.out;
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		String s = in.nextLine().trim();
		String p = in.nextLine().trim();
		s += s;
		if (s.indexOf(p) < 0) {
			out.println("No");
		} else {
			out.println("Yes");
		}
	}
}