import java.util.Scanner;

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

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		s += s.substring(0, s.length() - 1);
		if(s.indexOf(p) == -1){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
}