import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		String s = scan.next();
		String ss = s + s;
		String p = scan.next();
		boolean flag = false;
		for(int i = 0; i < ss.length() - p.length(); i++){
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		}
		System.out.println(flag? "Yes" : "No");
	}
} import java.util.*; util.* java public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		String s = scan.next();
		String ss = s + s;
		String p = scan.next();
		boolean flag = false;
		for(int i = 0; i < ss.length() - p.length(); i++){
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		}
		System.out.println(flag? "Yes" : "No");
	}
} Main private static final Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args){
		String s = scan.next();
		String ss = s + s;
		String p = scan.next();
		boolean flag = false;
		for(int i = 0; i < ss.length() - p.length(); i++){
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		}
		System.out.println(flag? "Yes" : "No");
	} main {
		String s = scan.next();
		String ss = s + s;
		String p = scan.next();
		boolean flag = false;
		for(int i = 0; i < ss.length() - p.length(); i++){
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		}
		System.out.println(flag? "Yes" : "No");
	} String s = scan.next(); s scan.next() scan.next scan String ss = s + s; ss s + s s s String p = scan.next(); p scan.next() scan.next scan boolean flag = false; flag false for(int i = 0; i < ss.length() - p.length(); i++){
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		} int i = 0; int i = 0; i 0 i < ss.length() - p.length() i ss.length() - p.length() ss.length() ss.length ss p.length() p.length p i++ i++ i {
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		} {
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		} String div = ss.substring(i,i + p.length()); div ss.substring(i,i + p.length()) ss.substring ss i i + p.length() i p.length() p.length p if(div.equals(p)){
				flag = true;
				break;
			} div.equals(p) div.equals div p {
				flag = true;
				break;
			} flag = true flag true break; System.out.println(flag? "Yes" : "No") System.out.println System.out System System.out flag? "Yes" : "No" flag "Yes" "No" String[] args args public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		String s = scan.next();
		String ss = s + s;
		String p = scan.next();
		boolean flag = false;
		for(int i = 0; i < ss.length() - p.length(); i++){
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		}
		System.out.println(flag? "Yes" : "No");
	}
} public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		String s = scan.next();
		String ss = s + s;
		String p = scan.next();
		boolean flag = false;
		for(int i = 0; i < ss.length() - p.length(); i++){
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		}
		System.out.println(flag? "Yes" : "No");
	}
} Main
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		String s = scan.next();
		String ss = s + s;
		String p = scan.next();
		boolean flag = false;
		for(int i = 0; i < ss.length() - p.length(); i++){
			String div = ss.substring(i,i + p.length());
			if(div.equals(p)){
				flag = true;
				break;
			}
		}
		System.out.println(flag? "Yes" : "No");
	}
}