import java.io.*;

class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String s = br.readLine();
			String p = br.readLine();
			String c;
			int flg=0;
			for(int i=0; i<s.length(); i++){
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			}
			if(flg==1) System.out.println("Yes");
			else       System.out.println("No");
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
} import java.io.*; io.* java class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String s = br.readLine();
			String p = br.readLine();
			String c;
			int flg=0;
			for(int i=0; i<s.length(); i++){
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			}
			if(flg==1) System.out.println("Yes");
			else       System.out.println("No");
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
} Main public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String s = br.readLine();
			String p = br.readLine();
			String c;
			int flg=0;
			for(int i=0; i<s.length(); i++){
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			}
			if(flg==1) System.out.println("Yes");
			else       System.out.println("No");
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	} main {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String s = br.readLine();
			String p = br.readLine();
			String c;
			int flg=0;
			for(int i=0; i<s.length(); i++){
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			}
			if(flg==1) System.out.println("Yes");
			else       System.out.println("No");
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	} try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String s = br.readLine();
			String p = br.readLine();
			String c;
			int flg=0;
			for(int i=0; i<s.length(); i++){
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			}
			if(flg==1) System.out.println("Yes");
			else       System.out.println("No");
		} catch(IOException e){
			System.out.println("Exception :" + e);
		} catch(IOException e){
			System.out.println("Exception :" + e);
		} IOException e {
			System.out.println("Exception :" + e);
		} System.out.println("Exception :" + e) System.out.println System.out System System.out "Exception :" + e "Exception :" e {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String s = br.readLine();
			String p = br.readLine();
			String c;
			int flg=0;
			for(int i=0; i<s.length(); i++){
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			}
			if(flg==1) System.out.println("Yes");
			else       System.out.println("No");
		} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br String c; c int flg=0; flg 0 for(int i=0; i<s.length(); i++){
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			} {
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			} if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				} i+p.length()<=s.length() i+p.length() i p.length() p.length p s.length() s.length s {
					c = s.substring(i, p.length()+i);
				} c = s.substring(i, p.length()+i) c s.substring(i, p.length()+i) s.substring s i p.length()+i p.length() p.length p i {
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				} c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i)) c s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i)) s.substring(i, s.length()) s.substring s i s.length() s.length s s.substring(0, p.length()-(s.length()-i)) s.substring s 0 p.length()-(s.length()-i) p.length() p.length p (s.length()-i) s.length() s.length s i if(p.equals(c)){
					flg = 1;
					break;
				} p.equals(c) p.equals p c {
					flg = 1;
					break;
				} flg = 1 flg 1 break; if(flg==1) System.out.println("Yes");
			else       System.out.println("No"); flg==1 flg 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" 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){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String s = br.readLine();
			String p = br.readLine();
			String c;
			int flg=0;
			for(int i=0; i<s.length(); i++){
				if(i+p.length()<=s.length()){
					c = s.substring(i, p.length()+i);
				} else{
					c = s.substring(i, s.length()) + s.substring(0, p.length()-(s.length()-i));
				}
				if(p.equals(c)){
					flg = 1;
					break;
				}
			}
			if(flg==1) System.out.println("Yes");
			else       System.out.println("No");
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
}