import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		String p = stdIn.next();
		s += s;
		boolean flag;

		for (int i=0; i<s.length()/2; i++) {
			if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
} import java.util.*; util.* java class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		String p = stdIn.next();
		s += s;
		boolean flag;

		for (int i=0; i<s.length()/2; i++) {
			if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		String p = stdIn.next();
		s += s;
		boolean flag;

		for (int i=0; i<s.length()/2; i++) {
			if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	} main {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		String p = stdIn.next();
		s += s;
		boolean flag;

		for (int i=0; i<s.length()/2; i++) {
			if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String s = stdIn.next(); s stdIn.next() stdIn.next stdIn String p = stdIn.next(); p stdIn.next() stdIn.next stdIn s += s s s boolean flag; flag for (int i=0; i<s.length()/2; i++) {
			if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			}
		} int i=0; int i=0; i 0 i<s.length()/2 i s.length()/2 s.length() s.length s 2 i++ i++ i {
			if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			}
		} {
			if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			}
		} if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					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 {
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			} flag = true flag true for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				} int j=i+1,k=1; int j=i+1 j i+1 i 1 k=1; k 1 k<p.length() k p.length() p.length p j++,k++ j++ j k++ k {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				} {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				} if(s.charAt(j) != p.charAt(k))
						flag = false; s.charAt(j) != p.charAt(k) s.charAt(j) s.charAt s j p.charAt(k) p.charAt p k flag = false flag false if(flag){
					System.out.println("Yes");
					return;
				} flag {
					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.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		String p = stdIn.next();
		s += s;
		boolean flag;

		for (int i=0; i<s.length()/2; i++) {
			if(s.charAt(i) == p.charAt(0)){
				flag = true;
				for (int j=i+1,k=1; k<p.length(); j++,k++) {
					if(s.charAt(j) != p.charAt(k))
						flag = false;
				}
				if(flag){
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
}