import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.nextLine().split("");
		String[] p = sc.nextLine().split("");
		
		for(int i=0; i<s.length; i++){
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		}
		
		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().split("");
		String[] p = sc.nextLine().split("");
		
		for(int i=0; i<s.length; i++){
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.nextLine().split("");
		String[] p = sc.nextLine().split("");
		
		for(int i=0; i<s.length; i++){
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	} main {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.nextLine().split("");
		String[] p = sc.nextLine().split("");
		
		for(int i=0; i<s.length; i++){
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s = sc.nextLine().split(""); s sc.nextLine().split("") sc.nextLine().split sc.nextLine() sc.nextLine sc "" String[] p = sc.nextLine().split(""); p sc.nextLine().split("") sc.nextLine().split sc.nextLine() sc.nextLine sc "" for(int i=0; i<s.length; i++){
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		} int i=0; int i=0; i 0 i<s.length i s.length s s.length i++ i++ i {
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		} {
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		} boolean flag = true; flag true for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			} int j=0; int j=0; j 0 j<p.length j p.length p p.length j++ j++ j {
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			} {
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			} if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				} !s[(i+j)%s.length].equals(p[j]) s[(i+j)%s.length].equals(p[j]) s[(i+j)%s.length].equals s[(i+j)%s.length] s (i+j)%s.length (i+j) i j s.length s s.length p[j] p j {
					flag = false;
					break;
				} flag = false flag false break; if(flag){
				System.out.println("Yes");
				return;
			} flag {
				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().split("");
		String[] p = sc.nextLine().split("");
		
		for(int i=0; i<s.length; i++){
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.nextLine().split("");
		String[] p = sc.nextLine().split("");
		
		for(int i=0; i<s.length; i++){
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		}
		
		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().split("");
		String[] p = sc.nextLine().split("");
		
		for(int i=0; i<s.length; i++){
			boolean flag = true;
			for(int j=0; j<p.length; j++){
				if(!s[(i+j)%s.length].equals(p[j])){
					flag = false;
					break;
				}
			}
			
			if(flag){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	}

}