import java.util.*;				
				
class Main {				
    public static void main(String[] args) {				
        Scanner sc=new Scanner(System.in);				
            String s = sc.nextLine();				
            String p = sc.nextLine();				
				
            int slen = s.length();				
            int plen = p.length();				
            int j = 0,i;				
            for( i = 0; i<slen; i++ ) {				
                if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                }				
                if( plen == j ) break;				
            }				
				
            if( plen == j ) {				
                System.out.println( "Yes" );            				
            } else {				
                System.out.println( "No" );				
            }				
    }				
}				
				 import java.util.*; util.* java class Main {				
    public static void main(String[] args) {				
        Scanner sc=new Scanner(System.in);				
            String s = sc.nextLine();				
            String p = sc.nextLine();				
				
            int slen = s.length();				
            int plen = p.length();				
            int j = 0,i;				
            for( i = 0; i<slen; i++ ) {				
                if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                }				
                if( plen == j ) break;				
            }				
				
            if( plen == j ) {				
                System.out.println( "Yes" );            				
            } else {				
                System.out.println( "No" );				
            }				
    }				
} Main public static void main(String[] args) {				
        Scanner sc=new Scanner(System.in);				
            String s = sc.nextLine();				
            String p = sc.nextLine();				
				
            int slen = s.length();				
            int plen = p.length();				
            int j = 0,i;				
            for( i = 0; i<slen; i++ ) {				
                if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                }				
                if( plen == j ) break;				
            }				
				
            if( plen == j ) {				
                System.out.println( "Yes" );            				
            } else {				
                System.out.println( "No" );				
            }				
    } main {				
        Scanner sc=new Scanner(System.in);				
            String s = sc.nextLine();				
            String p = sc.nextLine();				
				
            int slen = s.length();				
            int plen = p.length();				
            int j = 0,i;				
            for( i = 0; i<slen; i++ ) {				
                if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                }				
                if( plen == j ) break;				
            }				
				
            if( plen == j ) {				
                System.out.println( "Yes" );            				
            } else {				
                System.out.println( "No" );				
            }				
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc int slen = s.length(); slen s.length() s.length s int plen = p.length(); plen p.length() p.length p int j = 0 j 0 i; i for( i = 0; i<slen; i++ ) {				
                if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                }				
                if( plen == j ) break;				
            } i = 0; i = 0 i 0 i<slen i slen i++ i++ i {				
                if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                }				
                if( plen == j ) break;				
            } {				
                if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                }				
                if( plen == j ) break;				
            } if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                } p.charAt( 0 ) == s.charAt( i ) p.charAt( 0 ) p.charAt p 0 s.charAt( i ) s.charAt s i {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                } int k = i; k i for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    } j = 0; j = 0 j 0 j<plen j plen j++ j++ j {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    } {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    } k = ( i+j ) % slen k ( i+j ) % slen ( i+j ) i j slen if( p.charAt( j ) != s.charAt( k ) ) break; p.charAt( j ) != s.charAt( k ) p.charAt( j ) p.charAt p j s.charAt( k ) s.charAt s k break; if( plen == j ) break; plen == j plen j break; if( plen == j ) {				
                System.out.println( "Yes" );            				
            } else {				
                System.out.println( "No" );				
            } plen == j plen j {				
                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" String[] args args
import java.util.*;				
				
class Main {				
    public static void main(String[] args) {				
        Scanner sc=new Scanner(System.in);				
            String s = sc.nextLine();				
            String p = sc.nextLine();				
				
            int slen = s.length();				
            int plen = p.length();				
            int j = 0,i;				
            for( i = 0; i<slen; i++ ) {				
                if( p.charAt( 0 ) == s.charAt( i ) ) {				
                    int k = i;				
                    for( j = 0; j<plen; j++ ) {				
                        k = ( i+j ) % slen;				
                        if( p.charAt( j ) != s.charAt( k ) ) break;				
                    }				
                }				
                if( plen == j ) break;				
            }				
				
            if( plen == j ) {				
                System.out.println( "Yes" );            				
            } else {				
                System.out.println( "No" );				
            }				
    }				
}				
				
