import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		if(ringJad(s, p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

	/**
	 * ringJad
	 * ?????????s???????????????p???????????????????????????
	 * @param s
	 * @param p
	 * @return 
	 */
	static boolean ringJad(String s, String p){
		Boolean jad = true;
		while(true){
			if(s.length() <= p.length()) s += s; break;
		}
		s += s;
		if(!(s.indexOf(p) >= 0)){
			jad = false;
		}
		return jad;
	}

} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		if(ringJad(s, p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

	/**
	 * ringJad
	 * ?????????s???????????????p???????????????????????????
	 * @param s
	 * @param p
	 * @return 
	 */
	static boolean ringJad(String s, String p){
		Boolean jad = true;
		while(true){
			if(s.length() <= p.length()) s += s; break;
		}
		s += s;
		if(!(s.indexOf(p) >= 0)){
			jad = false;
		}
		return jad;
	}

} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		if(ringJad(s, p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		if(ringJad(s, p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan String p = scan.nextLine(); p scan.nextLine() scan.nextLine scan if(ringJad(s, p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} ringJad(s, p) ringJad s p {
			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 /**
	 * ringJad
	 * ?????????s???????????????p???????????????????????????
	 * @param s
	 * @param p
	 * @return 
	 */
	static boolean ringJad(String s, String p){
		Boolean jad = true;
		while(true){
			if(s.length() <= p.length()) s += s; break;
		}
		s += s;
		if(!(s.indexOf(p) >= 0)){
			jad = false;
		}
		return jad;
	} ringJad {
		Boolean jad = true;
		while(true){
			if(s.length() <= p.length()) s += s; break;
		}
		s += s;
		if(!(s.indexOf(p) >= 0)){
			jad = false;
		}
		return jad;
	} Boolean jad = true; jad true while(true){
			if(s.length() <= p.length()) s += s; break;
		} true {
			if(s.length() <= p.length()) s += s; break;
		} if(s.length() <= p.length()) s += s; s.length() <= p.length() s.length() s.length s p.length() p.length p s += s s s break; s += s s s if(!(s.indexOf(p) >= 0)){
			jad = false;
		} !(s.indexOf(p) >= 0) (s.indexOf(p) >= 0) s.indexOf(p) s.indexOf s p 0 {
			jad = false;
		} jad = false jad false return jad; jad String s s String p p public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		if(ringJad(s, p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

	/**
	 * ringJad
	 * ?????????s???????????????p???????????????????????????
	 * @param s
	 * @param p
	 * @return 
	 */
	static boolean ringJad(String s, String p){
		Boolean jad = true;
		while(true){
			if(s.length() <= p.length()) s += s; break;
		}
		s += s;
		if(!(s.indexOf(p) >= 0)){
			jad = false;
		}
		return jad;
	}

} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		if(ringJad(s, p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

	/**
	 * ringJad
	 * ?????????s???????????????p???????????????????????????
	 * @param s
	 * @param p
	 * @return 
	 */
	static boolean ringJad(String s, String p){
		Boolean jad = true;
		while(true){
			if(s.length() <= p.length()) s += s; break;
		}
		s += s;
		if(!(s.indexOf(p) >= 0)){
			jad = false;
		}
		return jad;
	}

} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		if(ringJad(s, p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

	/**
	 * ringJad
	 * ?????????s???????????????p???????????????????????????
	 * @param s
	 * @param p
	 * @return 
	 */
	static boolean ringJad(String s, String p){
		Boolean jad = true;
		while(true){
			if(s.length() <= p.length()) s += s; break;
		}
		s += s;
		if(!(s.indexOf(p) >= 0)){
			jad = false;
		}
		return jad;
	}

}