/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		
		String ring = s + s;
		
		if (ring.contains(p)) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");			
		}
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		
		String ring = s + s;
		
		if (ring.contains(p)) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");			
		}
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		
		String ring = s + s;
		
		if (ring.contains(p)) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");			
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		
		String ring = s + s;
		
		if (ring.contains(p)) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");			
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String p = scan.next(); p scan.next() scan.next scan String ring = s + s; ring s + s s s if (ring.contains(p)) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");			
		} ring.contains(p) ring.contains ring 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
/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		
		String ring = s + s;
		
		if (ring.contains(p)) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");			
		}
	}
}