import java.util.Scanner;

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

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			String s = sc.nextLine();
			String p = sc.nextLine();
			boolean yes = false;
			for(int i = 0;i<s.length();i++) {
				int j;
				for(j=0;j<p.length();j++) {
					if(s.charAt((i+j)%s.length())!=p.charAt(j)) break;
				}
				if(j==p.length()) {
					yes = true;
					break;
				}
			}
			System.out.println(yes?"Yes":"No");
		}
	}
}
