
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();

		sc.close();

//		String s = "abcdefg";
//		String p = "gab";

		// 指定文字数だけ繰り返し表示する
		for(int offset=0; offset<s.length(); offset++) {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		}

		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();

		sc.close();

//		String s = "abcdefg";
//		String p = "gab";

		// 指定文字数だけ繰り返し表示する
		for(int offset=0; offset<s.length(); offset++) {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		}

		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();

		sc.close();

//		String s = "abcdefg";
//		String p = "gab";

		// 指定文字数だけ繰り返し表示する
		for(int offset=0; offset<s.length(); offset++) {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		}

		System.out.println("No");

	} main {

		Scanner sc = new Scanner(System.in);

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

		sc.close();

//		String s = "abcdefg";
//		String p = "gab";

		// 指定文字数だけ繰り返し表示する
		for(int offset=0; offset<s.length(); offset++) {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		}

		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 sc.close() sc.close sc for(int offset=0; offset<s.length(); offset++) {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		} int offset=0; int offset=0; offset 0 offset<s.length() offset s.length() s.length s offset++ offset++ offset {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		} {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		} String cmpStr = ""; cmpStr "" for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			} int i=0; int i=0; i 0 i<p.length() i p.length() p.length p i++ i++ i {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			} {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			} int count = i + offset; count i + offset i offset if(count >= s.length()) count = count - s.length(); count >= s.length() count s.length() s.length s count = count - s.length() count count - s.length() count s.length() s.length s cmpStr += s.charAt(count) cmpStr s.charAt(count) s.charAt s count if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			} cmpStr.equals(p) cmpStr.equals cmpStr p {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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();

		sc.close();

//		String s = "abcdefg";
//		String p = "gab";

		// 指定文字数だけ繰り返し表示する
		for(int offset=0; offset<s.length(); offset++) {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		}

		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();

		sc.close();

//		String s = "abcdefg";
//		String p = "gab";

		// 指定文字数だけ繰り返し表示する
		for(int offset=0; offset<s.length(); offset++) {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		}

		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();

		sc.close();

//		String s = "abcdefg";
//		String p = "gab";

		// 指定文字数だけ繰り返し表示する
		for(int offset=0; offset<s.length(); offset++) {
			String cmpStr = "";
			for(int i=0; i<p.length(); i++) {
				int count = i + offset;
				if(count >= s.length()) count = count - s.length();
//				System.out.println(count);
				cmpStr += s.charAt(count);
//				System.out.print(s.charAt(count));
			}
			if(cmpStr.equals(p)) {
				System.out.println("Yes");
				return;
			}
//			System.out.println("");
		}

		System.out.println("No");

	}

}
