import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        
        String s = scanner.next();
        String p = scanner.next();
        
        String tmp = s + s;
        
        String result = "No";
        if ( tmp.indexOf(p) == -1) {
            result = "No";
        } else {
            result = "Yes";
        }
        
        System.out.println(result);
        
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        
        String s = scanner.next();
        String p = scanner.next();
        
        String tmp = s + s;
        
        String result = "No";
        if ( tmp.indexOf(p) == -1) {
            result = "No";
        } else {
            result = "Yes";
        }
        
        System.out.println(result);
        
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        
        String s = scanner.next();
        String p = scanner.next();
        
        String tmp = s + s;
        
        String result = "No";
        if ( tmp.indexOf(p) == -1) {
            result = "No";
        } else {
            result = "Yes";
        }
        
        System.out.println(result);
        
    } main {
        Scanner scanner = new Scanner(System.in);
        
        String s = scanner.next();
        String p = scanner.next();
        
        String tmp = s + s;
        
        String result = "No";
        if ( tmp.indexOf(p) == -1) {
            result = "No";
        } else {
            result = "Yes";
        }
        
        System.out.println(result);
        
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String p = scanner.next(); p scanner.next() scanner.next scanner String tmp = s + s; tmp s + s s s String result = "No"; result "No" if ( tmp.indexOf(p) == -1) {
            result = "No";
        } else {
            result = "Yes";
        } tmp.indexOf(p) == -1 tmp.indexOf(p) tmp.indexOf tmp p -1 1 {
            result = "No";
        } result = "No" result "No" {
            result = "Yes";
        } result = "Yes" result "Yes" System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        
        String s = scanner.next();
        String p = scanner.next();
        
        String tmp = s + s;
        
        String result = "No";
        if ( tmp.indexOf(p) == -1) {
            result = "No";
        } else {
            result = "Yes";
        }
        
        System.out.println(result);
        
    }
} public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        
        String s = scanner.next();
        String p = scanner.next();
        
        String tmp = s + s;
        
        String result = "No";
        if ( tmp.indexOf(p) == -1) {
            result = "No";
        } else {
            result = "Yes";
        }
        
        System.out.println(result);
        
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        
        String s = scanner.next();
        String p = scanner.next();
        
        String tmp = s + s;
        
        String result = "No";
        if ( tmp.indexOf(p) == -1) {
            result = "No";
        } else {
            result = "Yes";
        }
        
        System.out.println(result);
        
    }
}
