import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;



public class Main{
	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		}catch(IOException e){
			System.out.print(e);
		}
	}

	private static void check(Pattern pat, String ss){
		Matcher m=pat.matcher(ss);
		if(m.find()){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.regex.Matcher; Matcher java.util.regex import java.util.regex.Pattern; Pattern java.util.regex public class Main{
	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		}catch(IOException e){
			System.out.print(e);
		}
	}

	private static void check(Pattern pat, String ss){
		Matcher m=pat.matcher(ss);
		if(m.find()){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

} Main public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		}catch(IOException e){
			System.out.print(e);
		}
	} main {

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		}catch(IOException e){
			System.out.print(e);
		}
	} BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try{
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		}catch(IOException e){
			System.out.print(e);
		} catch(IOException e){
			System.out.print(e);
		} IOException e {
			System.out.print(e);
		} System.out.print(e) System.out.print System.out System System.out e {
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		} String s=reader.readLine(); s reader.readLine() reader.readLine reader String p=reader.readLine(); p reader.readLine() reader.readLine reader String ss=s+s; ss s+s s s Pattern pat=Pattern.compile(p); pat Pattern.compile(p) Pattern.compile Pattern p check(pat, ss) check pat ss String[] args args private static void check(Pattern pat, String ss){
		Matcher m=pat.matcher(ss);
		if(m.find()){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} check {
		Matcher m=pat.matcher(ss);
		if(m.find()){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} Matcher m=pat.matcher(ss); m pat.matcher(ss) pat.matcher pat ss if(m.find()){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} m.find() m.find m {
			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" Pattern pat pat String ss ss public class Main{
	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		}catch(IOException e){
			System.out.print(e);
		}
	}

	private static void check(Pattern pat, String ss){
		Matcher m=pat.matcher(ss);
		if(m.find()){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

} public class Main{
	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		}catch(IOException e){
			System.out.print(e);
		}
	}

	private static void check(Pattern pat, String ss){
		Matcher m=pat.matcher(ss);
		if(m.find()){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;



public class Main{
	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String s=reader.readLine();
		String p=reader.readLine();
		String ss=s+s;//s????????????????????¨??§???????????°???1?????¨???????????????

		//??£?????¨???????????£????±??????????

		Pattern pat=Pattern.compile(p);

		check(pat, ss);


		}catch(IOException e){
			System.out.print(e);
		}
	}

	private static void check(Pattern pat, String ss){
		Matcher m=pat.matcher(ss);
		if(m.find()){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}