import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		String inbase = std.nextLine();
		String inmatch = std.nextLine();

		inbase += inbase;
		if(inbase.indexOf(inmatch) == -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 std = new Scanner(System.in);
		String inbase = std.nextLine();
		String inmatch = std.nextLine();

		inbase += inbase;
		if(inbase.indexOf(inmatch) == -1){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
} Main public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		String inbase = std.nextLine();
		String inmatch = std.nextLine();

		inbase += inbase;
		if(inbase.indexOf(inmatch) == -1){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	} main {
		Scanner std = new Scanner(System.in);
		String inbase = std.nextLine();
		String inmatch = std.nextLine();

		inbase += inbase;
		if(inbase.indexOf(inmatch) == -1){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	} Scanner std = new Scanner(System.in); std new Scanner(System.in) String inbase = std.nextLine(); inbase std.nextLine() std.nextLine std String inmatch = std.nextLine(); inmatch std.nextLine() std.nextLine std inbase += inbase inbase inbase if(inbase.indexOf(inmatch) == -1){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		} inbase.indexOf(inmatch) == -1 inbase.indexOf(inmatch) inbase.indexOf inbase inmatch -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 std = new Scanner(System.in);
		String inbase = std.nextLine();
		String inmatch = std.nextLine();

		inbase += inbase;
		if(inbase.indexOf(inmatch) == -1){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
} public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		String inbase = std.nextLine();
		String inmatch = std.nextLine();

		inbase += inbase;
		if(inbase.indexOf(inmatch) == -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 std = new Scanner(System.in);
		String inbase = std.nextLine();
		String inmatch = std.nextLine();

		inbase += inbase;
		if(inbase.indexOf(inmatch) == -1){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
}