import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String str1=in.next(),str2=in.next();
		str1+=str1;
		if(str1.indexOf(str2)!=-1)out.println("Yes");
		else out.println("No");
		out.flush();
	}

}
 import java.util.*; util.* java import java.io.*; io.* java public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String str1=in.next(),str2=in.next();
		str1+=str1;
		if(str1.indexOf(str2)!=-1)out.println("Yes");
		else out.println("No");
		out.flush();
	}

} Main public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String str1=in.next(),str2=in.next();
		str1+=str1;
		if(str1.indexOf(str2)!=-1)out.println("Yes");
		else out.println("No");
		out.flush();
	} main {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String str1=in.next(),str2=in.next();
		str1+=str1;
		if(str1.indexOf(str2)!=-1)out.println("Yes");
		else out.println("No");
		out.flush();
	} Scanner in=new Scanner(System.in); in new Scanner(System.in) PrintWriter out=new PrintWriter(System.out); out new PrintWriter(System.out) String str1=in.next() str1 in.next() in.next in str2=in.next(); str2 in.next() in.next in str1+=str1 str1 str1 if(str1.indexOf(str2)!=-1)out.println("Yes");
		else out.println("No"); str1.indexOf(str2)!=-1 str1.indexOf(str2) str1.indexOf str1 str2 -1 1 out.println("Yes") out.println out "Yes" out.println("No") out.println out "No" out.flush() out.flush out String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String str1=in.next(),str2=in.next();
		str1+=str1;
		if(str1.indexOf(str2)!=-1)out.println("Yes");
		else out.println("No");
		out.flush();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String str1=in.next(),str2=in.next();
		str1+=str1;
		if(str1.indexOf(str2)!=-1)out.println("Yes");
		else out.println("No");
		out.flush();
	}

} Main
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String str1=in.next(),str2=in.next();
		str1+=str1;
		if(str1.indexOf(str2)!=-1)out.println("Yes");
		else out.println("No");
		out.flush();
	}

}

