import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		String p=scan.next();
		
		int m=s.length();
		
		for(int i=0;i<m;i++){
			if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			}
		}
		System.out.println("No");
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		String p=scan.next();
		
		int m=s.length();
		
		for(int i=0;i<m;i++){
			if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			}
		}
		System.out.println("No");
	}
} Main public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		String p=scan.next();
		
		int m=s.length();
		
		for(int i=0;i<m;i++){
			if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			}
		}
		System.out.println("No");
	} main {
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		String p=scan.next();
		
		int m=s.length();
		
		for(int i=0;i<m;i++){
			if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			}
		}
		System.out.println("No");
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String s=scan.next(); s scan.next() scan.next scan String p=scan.next(); p scan.next() scan.next scan int m=s.length(); m s.length() s.length s for(int i=0;i<m;i++){
			if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			}
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			}
		} {
			if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			}
		} if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			} s.charAt(i)==p.charAt(0) s.charAt(i) s.charAt s i p.charAt(0) p.charAt p 0 {
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			} int j; j for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				} j=0; j=0 j 0 j<p.length() j p.length() p.length p j++ j++ j {
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				} {
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				} if(s.charAt((i+j)%m) != p.charAt(j))
						break; s.charAt((i+j)%m) != p.charAt(j) s.charAt((i+j)%m) s.charAt s (i+j)%m (i+j) i j m p.charAt(j) p.charAt p j break; if(j==p.length()){
					System.out.println("Yes");
					return;
				} j==p.length() j p.length() p.length p {
					System.out.println("Yes");
					return;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		String p=scan.next();
		
		int m=s.length();
		
		for(int i=0;i<m;i++){
			if(s.charAt(i)==p.charAt(0)){
				int j;
				for(j=0;j<p.length();j++){
					if(s.charAt((i+j)%m) != p.charAt(j))
						break;
				}
				if(j==p.length()){
					System.out.println("Yes");
					return;
				}
				
			}
		}
		System.out.println("No");
	}
}
