import java.io.*;

class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String s = buf.readLine();
		String p = buf.readLine();
		String str1;

		str1 = s+s;

		if(str1.contains(p) == true)
			System.out.println("Yes");
		else
			System.out.println("No");
		
	}
} import java.io.*; io.* java class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String s = buf.readLine();
		String p = buf.readLine();
		String str1;

		str1 = s+s;

		if(str1.contains(p) == true)
			System.out.println("Yes");
		else
			System.out.println("No");
		
	}
} Main public static void main(String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String s = buf.readLine();
		String p = buf.readLine();
		String str1;

		str1 = s+s;

		if(str1.contains(p) == true)
			System.out.println("Yes");
		else
			System.out.println("No");
		
	} main {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String s = buf.readLine();
		String p = buf.readLine();
		String str1;

		str1 = s+s;

		if(str1.contains(p) == true)
			System.out.println("Yes");
		else
			System.out.println("No");
		
	} BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); buf new BufferedReader(new InputStreamReader(System.in)) String s = buf.readLine(); s buf.readLine() buf.readLine buf String p = buf.readLine(); p buf.readLine() buf.readLine buf String str1; str1 str1 = s+s str1 s+s s s if(str1.contains(p) == true)
			System.out.println("Yes");
		else
			System.out.println("No"); str1.contains(p) == true str1.contains(p) str1.contains str1 p true System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String args[] args
import java.io.*;

class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String s = buf.readLine();
		String p = buf.readLine();
		String str1;

		str1 = s+s;

		if(str1.contains(p) == true)
			System.out.println("Yes");
		else
			System.out.println("No");
		
	}
}