import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String p = scan.next();
		
		s = s.concat(s);
		int num = s.indexOf(p);
		
		if(num != -1) System.out.println("Yes");
		else          System.out.println("No");
		
		scan.close();
	
		
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String p = scan.next();
		
		s = s.concat(s);
		int num = s.indexOf(p);
		
		if(num != -1) System.out.println("Yes");
		else          System.out.println("No");
		
		scan.close();
	
		
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String p = scan.next();
		
		s = s.concat(s);
		int num = s.indexOf(p);
		
		if(num != -1) System.out.println("Yes");
		else          System.out.println("No");
		
		scan.close();
	
		
	} main {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String p = scan.next();
		
		s = s.concat(s);
		int num = s.indexOf(p);
		
		if(num != -1) System.out.println("Yes");
		else          System.out.println("No");
		
		scan.close();
	
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String p = scan.next(); p scan.next() scan.next scan s = s.concat(s) s s.concat(s) s.concat s s int num = s.indexOf(p); num s.indexOf(p) s.indexOf s p if(num != -1) System.out.println("Yes");
		else          System.out.println("No"); num != -1 num -1 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String p = scan.next();
		
		s = s.concat(s);
		int num = s.indexOf(p);
		
		if(num != -1) System.out.println("Yes");
		else          System.out.println("No");
		
		scan.close();
	
		
	}

} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String p = scan.next();
		
		s = s.concat(s);
		int num = s.indexOf(p);
		
		if(num != -1) System.out.println("Yes");
		else          System.out.println("No");
		
		scan.close();
	
		
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String p = scan.next();
		
		s = s.concat(s);
		int num = s.indexOf(p);
		
		if(num != -1) System.out.println("Yes");
		else          System.out.println("No");
		
		scan.close();
	
		
	}

}