import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String p=sc.next();
        int sl=s.length();
        int pl=p.length();
        s=s+s.substring(0,pl-1);
        for(int i=0;i<sl;i++){
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String p=sc.next();
        int sl=s.length();
        int pl=p.length();
        s=s+s.substring(0,pl-1);
        for(int i=0;i<sl;i++){
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String p=sc.next();
        int sl=s.length();
        int pl=p.length();
        s=s+s.substring(0,pl-1);
        for(int i=0;i<sl;i++){
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    } main {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String p=sc.next();
        int sl=s.length();
        int pl=p.length();
        s=s+s.substring(0,pl-1);
        for(int i=0;i<sl;i++){
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String s=sc.next(); s sc.next() sc.next sc String p=sc.next(); p sc.next() sc.next sc int sl=s.length(); sl s.length() s.length s int pl=p.length(); pl p.length() p.length p s=s+s.substring(0,pl-1) s s+s.substring(0,pl-1) s s.substring(0,pl-1) s.substring s 0 pl-1 pl 1 for(int i=0;i<sl;i++){
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        } int i=0; int i=0; i 0 i<sl i sl i++ i++ i {
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        } {
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        } for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            } int j=0; int j=0; j 0 j<pl j pl j++ j++ j {
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            } {
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            } if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                } s.substring(i,i+pl).equals(p) s.substring(i,i+pl).equals s.substring(i,i+pl) s.substring s i i+pl i pl p {
                    System.out.println("Yes");
                    System.exit(0);
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String p=sc.next();
        int sl=s.length();
        int pl=p.length();
        s=s+s.substring(0,pl-1);
        for(int i=0;i<sl;i++){
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String p=sc.next();
        int sl=s.length();
        int pl=p.length();
        s=s+s.substring(0,pl-1);
        for(int i=0;i<sl;i++){
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String p=sc.next();
        int sl=s.length();
        int pl=p.length();
        s=s+s.substring(0,pl-1);
        for(int i=0;i<sl;i++){
            for(int j=0;j<pl;j++){
                if(s.substring(i,i+pl).equals(p)){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    }
}

