import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		
		str2 += str2;
		
		String res = str2.contains(str1) ? "Yes" : "No";
		
		System.out.println(res);
	}
  
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		
		str2 += str2;
		
		String res = str2.contains(str1) ? "Yes" : "No";
		
		System.out.println(res);
	}
  
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		
		str2 += str2;
		
		String res = str2.contains(str1) ? "Yes" : "No";
		
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		
		str2 += str2;
		
		String res = str2.contains(str1) ? "Yes" : "No";
		
		System.out.println(res);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str1 = sc.nextLine(); str1 sc.nextLine() sc.nextLine sc String str2 = sc.nextLine(); str2 sc.nextLine() sc.nextLine sc sc.close() sc.close sc str2 += str2 str2 str2 String res = str2.contains(str1) ? "Yes" : "No"; res str2.contains(str1) ? "Yes" : "No" str2.contains(str1) str2.contains str2 str1 "Yes" "No" System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		
		str2 += str2;
		
		String res = str2.contains(str1) ? "Yes" : "No";
		
		System.out.println(res);
	}
  
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		
		str2 += str2;
		
		String res = str2.contains(str1) ? "Yes" : "No";
		
		System.out.println(res);
	}
  
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		
		str2 += str2;
		
		String res = str2.contains(str1) ? "Yes" : "No";
		
		System.out.println(res);
	}
  
}