import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			String b = sc.next();
			a=a+a;
			int c = a.length();
			int d = b.length();
			String f;
			boolean g=false;
			for(int e=0;e<c-d;++e){
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			}
			if(g){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
	}

} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			String b = sc.next();
			a=a+a;
			int c = a.length();
			int d = b.length();
			String f;
			boolean g=false;
			for(int e=0;e<c-d;++e){
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			}
			if(g){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
	}

} Main public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			String b = sc.next();
			a=a+a;
			int c = a.length();
			int d = b.length();
			String f;
			boolean g=false;
			for(int e=0;e<c-d;++e){
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			}
			if(g){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
	} main {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			String b = sc.next();
			a=a+a;
			int c = a.length();
			int d = b.length();
			String f;
			boolean g=false;
			for(int e=0;e<c-d;++e){
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			}
			if(g){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc a=a+a a a+a a a int c = a.length(); c a.length() a.length a int d = b.length(); d b.length() b.length b String f; f boolean g=false; g false for(int e=0;e<c-d;++e){
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			} int e=0; int e=0; e 0 e<c-d e c-d c d ++e ++e e {
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			} {
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			} f=a.substring(e,e+d) f a.substring(e,e+d) a.substring a e e+d e d if(b.equals(f)){
					g=true;
					break;
				} b.equals(f) b.equals b f {
					g=true;
					break;
				} g=true g true break; if(g){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			} g {
				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 public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			String b = sc.next();
			a=a+a;
			int c = a.length();
			int d = b.length();
			String f;
			boolean g=false;
			for(int e=0;e<c-d;++e){
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			}
			if(g){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
	}

} public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			String b = sc.next();
			a=a+a;
			int c = a.length();
			int d = b.length();
			String f;
			boolean g=false;
			for(int e=0;e<c-d;++e){
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			}
			if(g){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
	}

} Main
import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			String b = sc.next();
			a=a+a;
			int c = a.length();
			int d = b.length();
			String f;
			boolean g=false;
			for(int e=0;e<c-d;++e){
				f=a.substring(e,e+d);
				if(b.equals(f)){
					g=true;
					break;
				}
			}
			if(g){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
	}

}