import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		String ss = s+s;
		
		String[] sArray = ss.split(p);
		if(sArray.length>1 || p.equals(s)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}	
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		String ss = s+s;
		
		String[] sArray = ss.split(p);
		if(sArray.length>1 || p.equals(s)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}	
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		String ss = s+s;
		
		String[] sArray = ss.split(p);
		if(sArray.length>1 || p.equals(s)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		String ss = s+s;
		
		String[] sArray = ss.split(p);
		if(sArray.length>1 || p.equals(s)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc String ss = s+s; ss s+s s s String[] sArray = ss.split(p); sArray ss.split(p) ss.split ss p if(sArray.length>1 || p.equals(s)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} sArray.length>1 || p.equals(s) sArray.length>1 sArray.length sArray sArray.length 1 p.equals(s) p.equals p s {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} 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) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		String ss = s+s;
		
		String[] sArray = ss.split(p);
		if(sArray.length>1 || p.equals(s)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}	
} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		String ss = s+s;
		
		String[] sArray = ss.split(p);
		if(sArray.length>1 || p.equals(s)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}	
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String p = sc.next();
		String ss = s+s;
		
		String[] sArray = ss.split(p);
		if(sArray.length>1 || p.equals(s)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}	
}