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

/**
 * 
 */

/**
 * @author imkat
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		ArrayList<String> al = (new StandardIn()).getlines(2);
		String p,s;
		p = al.get(0);
		s = al.get(1);
		
		System.out.println((compareLikeRing(p,s)?"Yes":"No"));
		
	}
	
	static boolean compareLikeRing(String p, String s){
		boolean flag = false;
		for (int i=0; i<p.length();i++){
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		}
		return flag;
	}

	static String substringLikeRing(String p, int pos, int length){
		char buf[] = new char[length];
		int count = length;
		while(count > 0){
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		}
		return (String.valueOf(buf));
		
	}
}

class TempReaderCall{
	
	static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	}
}

class StandardIn{
	private BufferedReader br;
	
	StandardIn(){
		br = new BufferedReader (new InputStreamReader(System.in));
	}
	
	ArrayList<String> getlines(int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		if (line==0){
			String tmplinedata;
			while(null != (tmplinedata = br.readLine())){
				list.add(tmplinedata);
			}
		}
		else {
			for (int i = 0; i < line; i++)
				list.add(br.readLine());
		}
		return list;
	}
	
	ArrayList<String> getlines(String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	}
	
	String getaline() throws IOException {
		return (br.readLine());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		ArrayList<String> al = (new StandardIn()).getlines(2);
		String p,s;
		p = al.get(0);
		s = al.get(1);
		
		System.out.println((compareLikeRing(p,s)?"Yes":"No"));
		
	}
	
	static boolean compareLikeRing(String p, String s){
		boolean flag = false;
		for (int i=0; i<p.length();i++){
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		}
		return flag;
	}

	static String substringLikeRing(String p, int pos, int length){
		char buf[] = new char[length];
		int count = length;
		while(count > 0){
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		}
		return (String.valueOf(buf));
		
	}
} Main /**
	 * @param args
	 */
	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		ArrayList<String> al = (new StandardIn()).getlines(2);
		String p,s;
		p = al.get(0);
		s = al.get(1);
		
		System.out.println((compareLikeRing(p,s)?"Yes":"No"));
		
	} main {
		// TODO Auto-generated method stub
		ArrayList<String> al = (new StandardIn()).getlines(2);
		String p,s;
		p = al.get(0);
		s = al.get(1);
		
		System.out.println((compareLikeRing(p,s)?"Yes":"No"));
		
	} ArrayList<String> al = (new StandardIn()).getlines(2); al (new StandardIn()).getlines(2) (new StandardIn()).getlines (new StandardIn()) 2 String p p s; s p = al.get(0) p al.get(0) al.get al 0 s = al.get(1) s al.get(1) al.get al 1 System.out.println((compareLikeRing(p,s)?"Yes":"No")) System.out.println System.out System System.out (compareLikeRing(p,s)?"Yes":"No") compareLikeRing(p,s) compareLikeRing p s "Yes" "No" String[] args args static boolean compareLikeRing(String p, String s){
		boolean flag = false;
		for (int i=0; i<p.length();i++){
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		}
		return flag;
	} compareLikeRing {
		boolean flag = false;
		for (int i=0; i<p.length();i++){
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		}
		return flag;
	} boolean flag = false; flag false for (int i=0; i<p.length();i++){
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		} int i=0; int i=0; i 0 i<p.length() i p.length() p.length p i++ i++ i {
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		} {
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		} boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length()))); check (0==s.compareTo(substringLikeRing(p,i,s.length()))) 0 s.compareTo(substringLikeRing(p,i,s.length())) s.compareTo s substringLikeRing(p,i,s.length()) substringLikeRing p i s.length() s.length s flag = (check||flag) flag (check||flag) check flag return flag; flag String p p String s s static String substringLikeRing(String p, int pos, int length){
		char buf[] = new char[length];
		int count = length;
		while(count > 0){
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		}
		return (String.valueOf(buf));
		
	} substringLikeRing {
		char buf[] = new char[length];
		int count = length;
		while(count > 0){
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		}
		return (String.valueOf(buf));
		
	} char buf[] = new char[length]; buf new char[length] length int count = length; count length while(count > 0){
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		} count > 0 count 0 {
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		} buf[length-count]=p.charAt(pos) buf[length-count] buf length-count length count p.charAt(pos) p.charAt p pos pos++ pos count-- count if (pos>=p.length()) pos=0; pos>=p.length() pos p.length() p.length p pos=0 pos 0 return (String.valueOf(buf)); (String.valueOf(buf)) String.valueOf String buf String p p int pos pos int length length class TempReaderCall{
	
	static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	}
} TempReaderCall static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	} splitIntArrayFromString {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	} String[] sts = st.split(" "); sts st.split(" ") st.split st " " int[] data = new int[sts.length]; data new int[sts.length] sts.length sts sts.length for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		} int i=0; int i=0; i 0 i<sts.length i sts.length sts sts.length i++ i++ i {
			data[i] = Integer.parseInt(sts[i]);
		} {
			data[i] = Integer.parseInt(sts[i]);
		} data[i] = Integer.parseInt(sts[i]) data[i] data i Integer.parseInt(sts[i]) Integer.parseInt Integer sts[i] sts i return data; data String st st class StandardIn{
	private BufferedReader br;
	
	StandardIn(){
		br = new BufferedReader (new InputStreamReader(System.in));
	}
	
	ArrayList<String> getlines(int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		if (line==0){
			String tmplinedata;
			while(null != (tmplinedata = br.readLine())){
				list.add(tmplinedata);
			}
		}
		else {
			for (int i = 0; i < line; i++)
				list.add(br.readLine());
		}
		return list;
	}
	
	ArrayList<String> getlines(String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	}
	
	String getaline() throws IOException {
		return (br.readLine());
	}
} StandardIn private BufferedReader br; br StandardIn(){
		br = new BufferedReader (new InputStreamReader(System.in));
	} StandardIn {
		br = new BufferedReader (new InputStreamReader(System.in));
	} br = new BufferedReader (new InputStreamReader(System.in)) br new BufferedReader (new InputStreamReader(System.in)) ArrayList<String> getlines(int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		if (line==0){
			String tmplinedata;
			while(null != (tmplinedata = br.readLine())){
				list.add(tmplinedata);
			}
		}
		else {
			for (int i = 0; i < line; i++)
				list.add(br.readLine());
		}
		return list;
	} getlines {
		ArrayList<String> list = new ArrayList<String>();
		if (line==0){
			String tmplinedata;
			while(null != (tmplinedata = br.readLine())){
				list.add(tmplinedata);
			}
		}
		else {
			for (int i = 0; i < line; i++)
				list.add(br.readLine());
		}
		return list;
	} ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() if (line==0){
			String tmplinedata;
			while(null != (tmplinedata = br.readLine())){
				list.add(tmplinedata);
			}
		}
		else {
			for (int i = 0; i < line; i++)
				list.add(br.readLine());
		} line==0 line 0 {
			String tmplinedata;
			while(null != (tmplinedata = br.readLine())){
				list.add(tmplinedata);
			}
		} String tmplinedata; tmplinedata while(null != (tmplinedata = br.readLine())){
				list.add(tmplinedata);
			} null != (tmplinedata = br.readLine()) null (tmplinedata = br.readLine()) tmplinedata br.readLine() br.readLine br {
				list.add(tmplinedata);
			} list.add(tmplinedata) list.add list tmplinedata {
			for (int i = 0; i < line; i++)
				list.add(br.readLine());
		} for (int i = 0; i < line; i++)
				list.add(br.readLine()); int i = 0; int i = 0; i 0 i < line i line i++ i++ i list.add(br.readLine()); list.add(br.readLine()) list.add list br.readLine() br.readLine br return list; list int line line ArrayList<String> getlines(String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	} getlines {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	} ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() String newdata; newdata do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null); newdata!=null newdata null {
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		} newdata =br.readLine() newdata br.readLine() br.readLine br if (end.compareTo(newdata)==0)
				break; end.compareTo(newdata)==0 end.compareTo(newdata) end.compareTo end newdata 0 break; list.add(newdata) list.add list newdata return list; list String end end String getaline() throws IOException {
		return (br.readLine());
	} getaline {
		return (br.readLine());
	} return (br.readLine()); (br.readLine()) br.readLine br public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		ArrayList<String> al = (new StandardIn()).getlines(2);
		String p,s;
		p = al.get(0);
		s = al.get(1);
		
		System.out.println((compareLikeRing(p,s)?"Yes":"No"));
		
	}
	
	static boolean compareLikeRing(String p, String s){
		boolean flag = false;
		for (int i=0; i<p.length();i++){
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		}
		return flag;
	}

	static String substringLikeRing(String p, int pos, int length){
		char buf[] = new char[length];
		int count = length;
		while(count > 0){
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		}
		return (String.valueOf(buf));
		
	}
} public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		ArrayList<String> al = (new StandardIn()).getlines(2);
		String p,s;
		p = al.get(0);
		s = al.get(1);
		
		System.out.println((compareLikeRing(p,s)?"Yes":"No"));
		
	}
	
	static boolean compareLikeRing(String p, String s){
		boolean flag = false;
		for (int i=0; i<p.length();i++){
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		}
		return flag;
	}

	static String substringLikeRing(String p, int pos, int length){
		char buf[] = new char[length];
		int count = length;
		while(count > 0){
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		}
		return (String.valueOf(buf));
		
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

/**
 * 
 */

/**
 * @author imkat
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		ArrayList<String> al = (new StandardIn()).getlines(2);
		String p,s;
		p = al.get(0);
		s = al.get(1);
		
		System.out.println((compareLikeRing(p,s)?"Yes":"No"));
		
	}
	
	static boolean compareLikeRing(String p, String s){
		boolean flag = false;
		for (int i=0; i<p.length();i++){
			boolean check = (0==s.compareTo(substringLikeRing(p,i,s.length())));
			flag = (check||flag);
		}
		return flag;
	}

	static String substringLikeRing(String p, int pos, int length){
		char buf[] = new char[length];
		int count = length;
		while(count > 0){
			buf[length-count]=p.charAt(pos);
			pos++;
			count--;
			if (pos>=p.length()) pos=0;
		}
		return (String.valueOf(buf));
		
	}
}

class TempReaderCall{
	
	static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	}
}

class StandardIn{
	private BufferedReader br;
	
	StandardIn(){
		br = new BufferedReader (new InputStreamReader(System.in));
	}
	
	ArrayList<String> getlines(int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		if (line==0){
			String tmplinedata;
			while(null != (tmplinedata = br.readLine())){
				list.add(tmplinedata);
			}
		}
		else {
			for (int i = 0; i < line; i++)
				list.add(br.readLine());
		}
		return list;
	}
	
	ArrayList<String> getlines(String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	}
	
	String getaline() throws IOException {
		return (br.readLine());
	}
}