import java.util.Scanner;

public class Main{
	public static void main(String [] args){
		String s,p;
		Scanner sc = new Scanner(System.in);
		s = sc.nextLine();
		p = sc.nextLine();
		for(int i = 0; i < s.length(); i++){
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		}
		System.out.println("No");
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String [] args){
		String s,p;
		Scanner sc = new Scanner(System.in);
		s = sc.nextLine();
		p = sc.nextLine();
		for(int i = 0; i < s.length(); i++){
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		}
		System.out.println("No");
	}
} Main public static void main(String [] args){
		String s,p;
		Scanner sc = new Scanner(System.in);
		s = sc.nextLine();
		p = sc.nextLine();
		for(int i = 0; i < s.length(); i++){
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		}
		System.out.println("No");
	} main {
		String s,p;
		Scanner sc = new Scanner(System.in);
		s = sc.nextLine();
		p = sc.nextLine();
		for(int i = 0; i < s.length(); i++){
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		}
		System.out.println("No");
	} String s s p; p Scanner sc = new Scanner(System.in); sc new Scanner(System.in) s = sc.nextLine() s sc.nextLine() sc.nextLine sc p = sc.nextLine() p sc.nextLine() sc.nextLine sc for(int i = 0; i < s.length(); i++){
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		} {
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		} if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			} p.equals(s.substring(0,p.length())) p.equals p s.substring(0,p.length()) s.substring s 0 p.length() p.length p {
				System.out.println("Yes");
				System.exit(0);
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1) s s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1) s.substring(s.length() - 1, s.length()) s.substring s s.length() - 1 s.length() s.length s 1 s.length() s.length s s.substring(0,s.length() - 1) s.substring s 0 s.length() - 1 s.length() s.length s 1 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){
		String s,p;
		Scanner sc = new Scanner(System.in);
		s = sc.nextLine();
		p = sc.nextLine();
		for(int i = 0; i < s.length(); i++){
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		}
		System.out.println("No");
	}
} public class Main{
	public static void main(String [] args){
		String s,p;
		Scanner sc = new Scanner(System.in);
		s = sc.nextLine();
		p = sc.nextLine();
		for(int i = 0; i < s.length(); i++){
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		}
		System.out.println("No");
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String [] args){
		String s,p;
		Scanner sc = new Scanner(System.in);
		s = sc.nextLine();
		p = sc.nextLine();
		for(int i = 0; i < s.length(); i++){
			if(p.equals(s.substring(0,p.length()))){
				System.out.println("Yes");
				System.exit(0);
			}
			s = s.substring(s.length() - 1, s.length()) + s.substring(0,s.length() - 1);
		}
		System.out.println("No");
	}
}