import java.util.Scanner;

class Main {
  public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String roop = scanner.next();
		String search = scanner.next();
  		
  		roop = roop.concat(roop);
  		
  		int result = roop.lastIndexOf(search);
  	
		if (result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		scanner.close();
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String roop = scanner.next();
		String search = scanner.next();
  		
  		roop = roop.concat(roop);
  		
  		int result = roop.lastIndexOf(search);
  	
		if (result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		scanner.close();
  }
} Main public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String roop = scanner.next();
		String search = scanner.next();
  		
  		roop = roop.concat(roop);
  		
  		int result = roop.lastIndexOf(search);
  	
		if (result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		scanner.close();
  } main {
		Scanner scanner = new Scanner(System.in);
		String roop = scanner.next();
		String search = scanner.next();
  		
  		roop = roop.concat(roop);
  		
  		int result = roop.lastIndexOf(search);
  	
		if (result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		scanner.close();
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String roop = scanner.next(); roop scanner.next() scanner.next scanner String search = scanner.next(); search scanner.next() scanner.next scanner roop = roop.concat(roop) roop roop.concat(roop) roop.concat roop roop int result = roop.lastIndexOf(search); result roop.lastIndexOf(search) roop.lastIndexOf roop search if (result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} result != -1 result -1 1 {
			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" scanner.close() scanner.close scanner String args[] args
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String roop = scanner.next();
		String search = scanner.next();
  		
  		roop = roop.concat(roop);
  		
  		int result = roop.lastIndexOf(search);
  	
		if (result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		scanner.close();
  }
}
