import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
	        String s = kb.readLine();
	        String p = kb.readLine();
	        
	        int slen = s.length();
	        int plen = p.length();
	        int j = 0;
			for( int i = 0; i<slen; i++ ) {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			}
			
			if( plen == j ) {
				System.out.println( "Yes" );			
			} else {
				System.out.println( "No" );
			}
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
} import java.io.*; io.* java class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
	        String s = kb.readLine();
	        String p = kb.readLine();
	        
	        int slen = s.length();
	        int plen = p.length();
	        int j = 0;
			for( int i = 0; i<slen; i++ ) {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			}
			
			if( plen == j ) {
				System.out.println( "Yes" );			
			} else {
				System.out.println( "No" );
			}
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
} Main public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
	        String s = kb.readLine();
	        String p = kb.readLine();
	        
	        int slen = s.length();
	        int plen = p.length();
	        int j = 0;
			for( int i = 0; i<slen; i++ ) {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			}
			
			if( plen == j ) {
				System.out.println( "Yes" );			
			} else {
				System.out.println( "No" );
			}
		} catch( IOException e ) {
			System.err.println( e );
		}
	} main {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
	        String s = kb.readLine();
	        String p = kb.readLine();
	        
	        int slen = s.length();
	        int plen = p.length();
	        int j = 0;
			for( int i = 0; i<slen; i++ ) {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			}
			
			if( plen == j ) {
				System.out.println( "Yes" );			
			} else {
				System.out.println( "No" );
			}
		} catch( IOException e ) {
			System.err.println( e );
		}
	} BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) ); kb new BufferedReader( new InputStreamReader( System.in ) ) try {
	        String s = kb.readLine();
	        String p = kb.readLine();
	        
	        int slen = s.length();
	        int plen = p.length();
	        int j = 0;
			for( int i = 0; i<slen; i++ ) {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			}
			
			if( plen == j ) {
				System.out.println( "Yes" );			
			} else {
				System.out.println( "No" );
			}
		} catch( IOException e ) {
			System.err.println( e );
		} catch( IOException e ) {
			System.err.println( e );
		} IOException e {
			System.err.println( e );
		} System.err.println( e ) System.err.println System.err System System.err e {
	        String s = kb.readLine();
	        String p = kb.readLine();
	        
	        int slen = s.length();
	        int plen = p.length();
	        int j = 0;
			for( int i = 0; i<slen; i++ ) {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			}
			
			if( plen == j ) {
				System.out.println( "Yes" );			
			} else {
				System.out.println( "No" );
			}
		} String s = kb.readLine(); s kb.readLine() kb.readLine kb String p = kb.readLine(); p kb.readLine() kb.readLine kb 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 for( int i = 0; i<slen; i++ ) {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			} int i = 0; int i = 0; i 0 i<slen i slen i++ i++ i {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			} {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			} if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				} p.charAt( 0 ) == s.charAt( i ) p.charAt( 0 ) p.charAt p 0 s.charAt( i ) s.charAt s i {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				} int ij = i; ij i for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					} j = 0; j = 0 j 0 j<plen j plen j++ j++ j {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					} {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					} ij = ( i+j ) % slen ij ( i+j ) % slen ( i+j ) i j slen if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						} p.charAt( j ) != s.charAt( ij ) p.charAt( j ) p.charAt p j s.charAt( ij ) s.charAt s ij {
							break;
						} break; if( plen == j ) { break; } plen == j plen j { break; } 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.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
	        String s = kb.readLine();
	        String p = kb.readLine();
	        
	        int slen = s.length();
	        int plen = p.length();
	        int j = 0;
			for( int i = 0; i<slen; i++ ) {
				if( p.charAt( 0 ) == s.charAt( i ) ) {
					int ij = i;
					for( j = 0; j<plen; j++ ) {
						ij = ( i+j ) % slen;
						if( p.charAt( j ) != s.charAt( ij ) ) {
							break;
						}
					}
				}
				if( plen == j ) { break; }
			}
			
			if( plen == j ) {
				System.out.println( "Yes" );			
			} else {
				System.out.println( "No" );
			}
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
}