import java.util.*;
public class Main{
	static String Rort(String s, String t){
		String ss = s + s;
		ss = ss.replaceFirst(t, "");
		if(ss.equals(s))return "Yes";
		return "No";
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Rort(S, T));
	}
} import java.util.*; util.* java public class Main{
	static String Rort(String s, String t){
		String ss = s + s;
		ss = ss.replaceFirst(t, "");
		if(ss.equals(s))return "Yes";
		return "No";
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Rort(S, T));
	}
} Main static String Rort(String s, String t){
		String ss = s + s;
		ss = ss.replaceFirst(t, "");
		if(ss.equals(s))return "Yes";
		return "No";
	} Rort {
		String ss = s + s;
		ss = ss.replaceFirst(t, "");
		if(ss.equals(s))return "Yes";
		return "No";
	} String ss = s + s; ss s + s s s ss = ss.replaceFirst(t, "") ss ss.replaceFirst(t, "") ss.replaceFirst ss t "" if(ss.equals(s))return "Yes"; ss.equals(s) ss.equals ss s return "Yes"; "Yes" return "No"; "No" String s s String t t public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Rort(S, T));
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Rort(S, T));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc System.out.println(Rort(S, T)) System.out.println System.out System System.out Rort(S, T) Rort S T String[] args args public class Main{
	static String Rort(String s, String t){
		String ss = s + s;
		ss = ss.replaceFirst(t, "");
		if(ss.equals(s))return "Yes";
		return "No";
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Rort(S, T));
	}
} public class Main{
	static String Rort(String s, String t){
		String ss = s + s;
		ss = ss.replaceFirst(t, "");
		if(ss.equals(s))return "Yes";
		return "No";
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Rort(S, T));
	}
} Main
import java.util.*;
public class Main{
	static String Rort(String s, String t){
		String ss = s + s;
		ss = ss.replaceFirst(t, "");
		if(ss.equals(s))return "Yes";
		return "No";
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Rort(S, T));
	}
}