import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{

	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		
		String strS = br.readLine();
		String strP = br.readLine();
		
		StringBuffer sb = new StringBuffer(strS);
		
		sb.append(strS);
		
		System.out.println( (sb.indexOf(strP) == -1 ? "No" : "Yes") );
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main{

	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		
		String strS = br.readLine();
		String strP = br.readLine();
		
		StringBuffer sb = new StringBuffer(strS);
		
		sb.append(strS);
		
		System.out.println( (sb.indexOf(strP) == -1 ? "No" : "Yes") );
	}
} Main public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		
		String strS = br.readLine();
		String strP = br.readLine();
		
		StringBuffer sb = new StringBuffer(strS);
		
		sb.append(strS);
		
		System.out.println( (sb.indexOf(strP) == -1 ? "No" : "Yes") );
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		
		String strS = br.readLine();
		String strP = br.readLine();
		
		StringBuffer sb = new StringBuffer(strS);
		
		sb.append(strS);
		
		System.out.println( (sb.indexOf(strP) == -1 ? "No" : "Yes") );
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in) ); br new BufferedReader(new InputStreamReader(System.in) ) String strS = br.readLine(); strS br.readLine() br.readLine br String strP = br.readLine(); strP br.readLine() br.readLine br StringBuffer sb = new StringBuffer(strS); sb new StringBuffer(strS) sb.append(strS) sb.append sb strS System.out.println( (sb.indexOf(strP) == -1 ? "No" : "Yes") ) System.out.println System.out System System.out (sb.indexOf(strP) == -1 ? "No" : "Yes") sb.indexOf(strP) == -1 sb.indexOf(strP) sb.indexOf sb strP -1 1 "No" "Yes" String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{

	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		
		String strS = br.readLine();
		String strP = br.readLine();
		
		StringBuffer sb = new StringBuffer(strS);
		
		sb.append(strS);
		
		System.out.println( (sb.indexOf(strP) == -1 ? "No" : "Yes") );
	}
}