import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		String s = scanner.next();
		String p = scanner.next();
		
		String out = "No";
		for(int i=0; i<s.length(); i++)
		{
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		}
		System.out.println(out);
	}
} import java.util.Scanner; Scanner java.util public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		String s = scanner.next();
		String p = scanner.next();
		
		String out = "No";
		for(int i=0; i<s.length(); i++)
		{
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		}
		System.out.println(out);
	}
} Main public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		String s = scanner.next();
		String p = scanner.next();
		
		String out = "No";
		for(int i=0; i<s.length(); i++)
		{
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		}
		System.out.println(out);
	} main {
		Scanner scanner = new Scanner(System.in);
		
		String s = scanner.next();
		String p = scanner.next();
		
		String out = "No";
		for(int i=0; i<s.length(); i++)
		{
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		}
		System.out.println(out);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String p = scanner.next(); p scanner.next() scanner.next scanner String out = "No"; out "No" for(int i=0; i<s.length(); i++)
		{
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		} {
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		} String str = ""; str "" for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			} int j=0; int j=0; j 0 j<p.length() j p.length() p.length p j++ j++ j {
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			} {
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			} int k = i+j; k i+j i j if(k >= s.length())
				{
					k -= s.length(); 
				} k >= s.length() k s.length() s.length s {
					k -= s.length(); 
				} k -= s.length() k s.length() s.length s str += s.substring(k, k+1) str s.substring(k, k+1) s.substring s k k+1 k 1 if(p.equals(str))
			{
				out = "Yes";
				break;
			} p.equals(str) p.equals p str {
				out = "Yes";
				break;
			} out = "Yes" out "Yes" break; System.out.println(out) System.out.println System.out System System.out out String[] args args public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		String s = scanner.next();
		String p = scanner.next();
		
		String out = "No";
		for(int i=0; i<s.length(); i++)
		{
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		}
		System.out.println(out);
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		String s = scanner.next();
		String p = scanner.next();
		
		String out = "No";
		for(int i=0; i<s.length(); i++)
		{
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		}
		System.out.println(out);
	}
} Main
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		String s = scanner.next();
		String p = scanner.next();
		
		String out = "No";
		for(int i=0; i<s.length(); i++)
		{
			String str = "";
			for(int j=0; j<p.length(); j++)
			{
				int k = i+j;
				if(k >= s.length())
				{
					k -= s.length(); 
				}
				str += s.substring(k, k+1);
			}
			
			if(p.equals(str))
			{
				out = "Yes";
				break;
			}
		}
		System.out.println(out);
	}
}