import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;


public class Main {
	
	public static void main(String[] args) throws IOException {
		Main m = new Main();
		//*
		m.input();
		m.solve();
		m.output();
		/*/
		m.debug();
		//*/
	}
	
	
	public void debug() {
	}
	InputUtil in = new InputUtil();
	PrintWriter out = new PrintWriter(System.out);
	
	String S,T;
	boolean ans = false;
			
	public void input() throws IOException {
		S = in.nextLine();
		T = in.nextLine();
	}
	
	public void solve() throws IOException {
		for (int i=0; i<S.length(); i++) {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		}
	}
	
	private String solveSub(String s) {
		return s.substring(s.length()-1)+s.substring(0,s.length()-1);
	}
	
	public void output() {
		out.println(ans?"Yes":"No");
		out.flush();
	}
	
}

class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 100000;
	boolean lineMode = false;
	
	//Fields
	protected InputStream in;
	private byte[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private DataInputStream dis = null;
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
	protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		}
	}
	
	
	//String Input Reader/Parser
	private boolean isCrLf(byte b) {return b == 0x0a || b == 0x0d; }
	
	private void skipOneCrLf() throws IOException {
		byte b = buf[ptr];
		if (isCrLf(b)) {
			ptr++;
			if (b == 0x0d) {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			}
		}
	}
	
	public String nextLine() throws IOException {
		StringBuilder sb = new StringBuilder();
		boolean isFirst = true;
		for(readBuf(); ptr < max ;readBuf()) {
			byte b = buf[ptr];
			if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			}
			isFirst = false;
		}
		lineMode = true;
		return sb.toString();
	}
	
	public byte nextByte() throws IOException {
		lineMode=false;
		readBuf();
		if(ptr < max) {
			return buf[ptr++];
		}else{
			return -1;
		}
	}
	
	//Number Input Reader/Parser
	private boolean isNum(byte b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(byte b) {return b=='-'; }
	
	public int nextInt() throws IOException {
		lineMode=false;
		readBuf();
		return (int)_nextLong();
	}
	
	public int[] nextInt(int[] result) throws IOException {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = (int)_nextLong();
		}
		return result;
	}
	
	private long _nextLong() throws IOException {
		int sign = 1;
		long res = 0;
		byte c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public long nextLong() throws IOException {
		lineMode=false;
		readBuf();
		return _nextLong();
	}
	
	public long[] nextLong(long[] result) throws IOException {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextLong();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}

}

class OutputUtil {
	public static final String EOF = System.lineSeparator();

	public static void outputDivSpace(PrintWriter out, int[] a) {
		OutputUtil.output(out,a,0,a.length," ");
	}
	
	public static void outputDivEOF(PrintWriter out, int[] a) {
		OutputUtil.output(out,a,0,a.length,EOF);
	}
	
	public static void output(PrintWriter out, int[] a, int off, int len, String delim) {
		out.print(a[off]);
		for(int i=off+1; i<len; i++){
			out.print(delim);
			out.print(a[i]);
		}
		out.println("");
		out.flush();
	}
} import java.io.DataInputStream; DataInputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.math.BigInteger; BigInteger java.math import java.util.Arrays; Arrays java.util public class Main {
	
	public static void main(String[] args) throws IOException {
		Main m = new Main();
		//*
		m.input();
		m.solve();
		m.output();
		/*/
		m.debug();
		//*/
	}
	
	
	public void debug() {
	}
	InputUtil in = new InputUtil();
	PrintWriter out = new PrintWriter(System.out);
	
	String S,T;
	boolean ans = false;
			
	public void input() throws IOException {
		S = in.nextLine();
		T = in.nextLine();
	}
	
	public void solve() throws IOException {
		for (int i=0; i<S.length(); i++) {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		}
	}
	
	private String solveSub(String s) {
		return s.substring(s.length()-1)+s.substring(0,s.length()-1);
	}
	
	public void output() {
		out.println(ans?"Yes":"No");
		out.flush();
	}
	
} Main InputUtil in = new InputUtil(); in new InputUtil() PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) String S S T; T boolean ans = false; ans false public static void main(String[] args) throws IOException {
		Main m = new Main();
		//*
		m.input();
		m.solve();
		m.output();
		/*/
		m.debug();
		//*/
	} main {
		Main m = new Main();
		//*
		m.input();
		m.solve();
		m.output();
		/*/
		m.debug();
		//*/
	} Main m = new Main(); m new Main() m.input() m.input m m.solve() m.solve m m.output() m.output m String[] args args public void debug() {
	} debug {
	} public void input() throws IOException {
		S = in.nextLine();
		T = in.nextLine();
	} input {
		S = in.nextLine();
		T = in.nextLine();
	} S = in.nextLine() S in.nextLine() in.nextLine in T = in.nextLine() T in.nextLine() in.nextLine in public void solve() throws IOException {
		for (int i=0; i<S.length(); i++) {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		}
	} solve {
		for (int i=0; i<S.length(); i++) {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		}
	} for (int i=0; i<S.length(); i++) {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		} int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		} {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		} S = solveSub(S) S solveSub(S) solveSub S if (S.equals(T)) {
				ans = true;
				break;
			} S.equals(T) S.equals S T {
				ans = true;
				break;
			} ans = true ans true break; private String solveSub(String s) {
		return s.substring(s.length()-1)+s.substring(0,s.length()-1);
	} solveSub {
		return s.substring(s.length()-1)+s.substring(0,s.length()-1);
	} return s.substring(s.length()-1)+s.substring(0,s.length()-1); s.substring(s.length()-1)+s.substring(0,s.length()-1) s.substring(s.length()-1) s.substring s s.length()-1 s.length() s.length s 1 s.substring(0,s.length()-1) s.substring s 0 s.length()-1 s.length() s.length s 1 String s s public void output() {
		out.println(ans?"Yes":"No");
		out.flush();
	} output {
		out.println(ans?"Yes":"No");
		out.flush();
	} out.println(ans?"Yes":"No") out.println out ans?"Yes":"No" ans "Yes" "No" out.flush() out.flush out class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 100000;
	boolean lineMode = false;
	
	//Fields
	protected InputStream in;
	private byte[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private DataInputStream dis = null;
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
	protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		}
	}
	
	
	//String Input Reader/Parser
	private boolean isCrLf(byte b) {return b == 0x0a || b == 0x0d; }
	
	private void skipOneCrLf() throws IOException {
		byte b = buf[ptr];
		if (isCrLf(b)) {
			ptr++;
			if (b == 0x0d) {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			}
		}
	}
	
	public String nextLine() throws IOException {
		StringBuilder sb = new StringBuilder();
		boolean isFirst = true;
		for(readBuf(); ptr < max ;readBuf()) {
			byte b = buf[ptr];
			if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			}
			isFirst = false;
		}
		lineMode = true;
		return sb.toString();
	}
	
	public byte nextByte() throws IOException {
		lineMode=false;
		readBuf();
		if(ptr < max) {
			return buf[ptr++];
		}else{
			return -1;
		}
	}
	
	//Number Input Reader/Parser
	private boolean isNum(byte b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(byte b) {return b=='-'; }
	
	public int nextInt() throws IOException {
		lineMode=false;
		readBuf();
		return (int)_nextLong();
	}
	
	public int[] nextInt(int[] result) throws IOException {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = (int)_nextLong();
		}
		return result;
	}
	
	private long _nextLong() throws IOException {
		int sign = 1;
		long res = 0;
		byte c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public long nextLong() throws IOException {
		lineMode=false;
		readBuf();
		return _nextLong();
	}
	
	public long[] nextLong(long[] result) throws IOException {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextLong();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}

} InputUtil //Static Fields
	private static final int BUFSIZ = 100000; BUFSIZ 100000 boolean lineMode = false; lineMode false //Fields
	protected InputStream in; in private byte[] buf = null; buf null private int ptr = 0; ptr 0 private int max = -1; max -1 1 private DataInputStream dis = null; dis null //Constructors
	public InputUtil() {this(System.in,BUFSIZ);} InputUtil {this(System.in,BUFSIZ);} this(System.in,BUFSIZ) this System.in System System.in BUFSIZ public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	} InputUtil {
		initBuf(bufsiz);
		initIn(in);
	} initBuf(bufsiz) initBuf bufsiz initIn(in) initIn in InputStream in in int bufsiz bufsiz //Methods
	//Initializer
	protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);} initIn {dis = new DataInputStream(this.in = in);} dis = new DataInputStream(this.in = in) dis new DataInputStream(this.in = in) InputStream in in protected void initBuf(int bufsiz) {buf = new byte[bufsiz];} initBuf {buf = new byte[bufsiz];} buf = new byte[bufsiz] buf new byte[bufsiz] bufsiz int bufsiz bufsiz //buffer operation
	private void next() throws IOException {ptr++; readBuf();} next {ptr++; readBuf();} ptr++ ptr readBuf() readBuf private void readBuf() throws IOException {
		if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		}
	} readBuf {
		if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		}
	} if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		} ptr >= max && dis.available()>0 ptr >= max ptr max dis.available()>0 dis.available() dis.available dis 0 {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		} if(max>0) Arrays.fill(buf,0,max,(byte)0); max>0 max 0 Arrays.fill(buf,0,max,(byte)0) Arrays.fill Arrays buf 0 max (byte)0 max = dis.read(buf) max dis.read(buf) dis.read dis buf ptr = 0 ptr 0 //String Input Reader/Parser
	private boolean isCrLf(byte b) {return b == 0x0a || b == 0x0d; } isCrLf {return b == 0x0a || b == 0x0d; } return b == 0x0a || b == 0x0d; b == 0x0a || b == 0x0d b == 0x0a b 0x0a b == 0x0d b 0x0d byte b b private void skipOneCrLf() throws IOException {
		byte b = buf[ptr];
		if (isCrLf(b)) {
			ptr++;
			if (b == 0x0d) {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			}
		}
	} skipOneCrLf {
		byte b = buf[ptr];
		if (isCrLf(b)) {
			ptr++;
			if (b == 0x0d) {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			}
		}
	} byte b = buf[ptr]; b buf[ptr] buf ptr if (isCrLf(b)) {
			ptr++;
			if (b == 0x0d) {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			}
		} isCrLf(b) isCrLf b {
			ptr++;
			if (b == 0x0d) {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			}
		} ptr++ ptr if (b == 0x0d) {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			} b == 0x0d b 0x0d {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			} readBuf() readBuf if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				} ptr < max && buf[ptr] == 0x0a ptr < max ptr max buf[ptr] == 0x0a buf[ptr] buf ptr 0x0a {
					ptr++;
				} ptr++ ptr public String nextLine() throws IOException {
		StringBuilder sb = new StringBuilder();
		boolean isFirst = true;
		for(readBuf(); ptr < max ;readBuf()) {
			byte b = buf[ptr];
			if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			}
			isFirst = false;
		}
		lineMode = true;
		return sb.toString();
	} nextLine {
		StringBuilder sb = new StringBuilder();
		boolean isFirst = true;
		for(readBuf(); ptr < max ;readBuf()) {
			byte b = buf[ptr];
			if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			}
			isFirst = false;
		}
		lineMode = true;
		return sb.toString();
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() boolean isFirst = true; isFirst true for(readBuf(); ptr < max ;readBuf()) {
			byte b = buf[ptr];
			if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			}
			isFirst = false;
		} readBuf(); readBuf() readBuf ptr < max ptr max readBuf() readBuf() readBuf {
			byte b = buf[ptr];
			if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			}
			isFirst = false;
		} {
			byte b = buf[ptr];
			if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			}
			isFirst = false;
		} byte b = buf[ptr]; b buf[ptr] buf ptr if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			} isCrLf(b) isCrLf b {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			} skipOneCrLf() skipOneCrLf if (!isFirst || lineMode) {
					break;
				} !isFirst || lineMode !isFirst isFirst lineMode {
					break;
				} break; {
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			} int strPtr = ptr++; strPtr ptr++ ptr int endPtr = -1; endPtr -1 1 for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				} int i = ptr; int i = ptr; i ptr i<max i max i++ i++ i {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				} {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				} if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					} isCrLf(buf[i]) isCrLf buf[i] buf i {
						endPtr = i;
						break;
					} endPtr = i endPtr i break; if(endPtr == -1) endPtr = max; endPtr == -1 endPtr -1 1 endPtr = max endPtr max sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8")) sb.append sb new String(buf,strPtr,endPtr-strPtr,"UTF-8") ptr = endPtr ptr endPtr isFirst = false isFirst false lineMode = true lineMode true return sb.toString(); sb.toString() sb.toString sb public byte nextByte() throws IOException {
		lineMode=false;
		readBuf();
		if(ptr < max) {
			return buf[ptr++];
		}else{
			return -1;
		}
	} nextByte {
		lineMode=false;
		readBuf();
		if(ptr < max) {
			return buf[ptr++];
		}else{
			return -1;
		}
	} lineMode=false lineMode false readBuf() readBuf if(ptr < max) {
			return buf[ptr++];
		}else{
			return -1;
		} ptr < max ptr max {
			return buf[ptr++];
		} return buf[ptr++]; buf[ptr++] buf ptr++ ptr {
			return -1;
		} return -1; -1 1 //Number Input Reader/Parser
	private boolean isNum(byte b) {return '0' <= b && b <= '9'; } isNum {return '0' <= b && b <= '9'; } return '0' <= b && b <= '9'; '0' <= b && b <= '9' '0' <= b '0' b b <= '9' b '9' byte b b private boolean isMinus(byte b) {return b=='-'; } isMinus {return b=='-'; } return b=='-'; b=='-' b '-' byte b b public int nextInt() throws IOException {
		lineMode=false;
		readBuf();
		return (int)_nextLong();
	} nextInt {
		lineMode=false;
		readBuf();
		return (int)_nextLong();
	} lineMode=false lineMode false readBuf() readBuf return (int)_nextLong(); (int)_nextLong() _nextLong public int[] nextInt(int[] result) throws IOException {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = (int)_nextLong();
		}
		return result;
	} nextInt {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = (int)_nextLong();
		}
		return result;
	} lineMode=false lineMode false readBuf() readBuf for(int i=0; i<result.length; i++) {
			result[i] = (int)_nextLong();
		} int i=0; int i=0; i 0 i<result.length i result.length result result.length i++ i++ i {
			result[i] = (int)_nextLong();
		} {
			result[i] = (int)_nextLong();
		} result[i] = (int)_nextLong() result[i] result i (int)_nextLong() _nextLong return result; result int[] result result private long _nextLong() throws IOException {
		int sign = 1;
		long res = 0;
		byte c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	} _nextLong {
		int sign = 1;
		long res = 0;
		byte c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	} int sign = 1; sign 1 long res = 0; res 0 byte c; c while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next(); !isNum(c=buf[ptr]) && !isMinus(c) !isNum(c=buf[ptr]) isNum(c=buf[ptr]) isNum c=buf[ptr] c buf[ptr] buf ptr !isMinus(c) isMinus(c) isMinus c next() next if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		} isMinus(buf[ptr]) isMinus buf[ptr] buf ptr {
			sign = -1;
			next();
		} sign = -1 sign -1 1 next() next while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		} isNum(c=buf[ptr]) isNum c=buf[ptr] c buf[ptr] buf ptr {
			res *= 10;
			res += c - '0' ;
			next();
		} res *= 10 res 10 res += c - '0' res c - '0' c '0' next() next next() next return sign * res; sign * res sign res public long nextLong() throws IOException {
		lineMode=false;
		readBuf();
		return _nextLong();
	} nextLong {
		lineMode=false;
		readBuf();
		return _nextLong();
	} lineMode=false lineMode false readBuf() readBuf return _nextLong(); _nextLong() _nextLong public long[] nextLong(long[] result) throws IOException {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextLong();
		}
		return result;
	} nextLong {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextLong();
		}
		return result;
	} lineMode=false lineMode false readBuf() readBuf for(int i=0; i<result.length; i++) {
			result[i] = _nextLong();
		} int i=0; int i=0; i 0 i<result.length i result.length result result.length i++ i++ i {
			result[i] = _nextLong();
		} {
			result[i] = _nextLong();
		} result[i] = _nextLong() result[i] result i _nextLong() _nextLong return result; result long[] result result //Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	} close {
		if(!this.in.equals(System.in)) 
			this.in.close();
	} if(!this.in.equals(System.in)) 
			this.in.close(); !this.in.equals(System.in) this.in.equals(System.in) this.in.equals this.in this this.in System.in System System.in this.in.close() this.in.close this.in this this.in class OutputUtil {
	public static final String EOF = System.lineSeparator();

	public static void outputDivSpace(PrintWriter out, int[] a) {
		OutputUtil.output(out,a,0,a.length," ");
	}
	
	public static void outputDivEOF(PrintWriter out, int[] a) {
		OutputUtil.output(out,a,0,a.length,EOF);
	}
	
	public static void output(PrintWriter out, int[] a, int off, int len, String delim) {
		out.print(a[off]);
		for(int i=off+1; i<len; i++){
			out.print(delim);
			out.print(a[i]);
		}
		out.println("");
		out.flush();
	}
} OutputUtil public static final String EOF = System.lineSeparator(); EOF System.lineSeparator() System.lineSeparator System public static void outputDivSpace(PrintWriter out, int[] a) {
		OutputUtil.output(out,a,0,a.length," ");
	} outputDivSpace {
		OutputUtil.output(out,a,0,a.length," ");
	} OutputUtil.output(out,a,0,a.length," ") OutputUtil.output OutputUtil out a 0 a.length a a.length " " PrintWriter out out int[] a a public static void outputDivEOF(PrintWriter out, int[] a) {
		OutputUtil.output(out,a,0,a.length,EOF);
	} outputDivEOF {
		OutputUtil.output(out,a,0,a.length,EOF);
	} OutputUtil.output(out,a,0,a.length,EOF) OutputUtil.output OutputUtil out a 0 a.length a a.length EOF PrintWriter out out int[] a a public static void output(PrintWriter out, int[] a, int off, int len, String delim) {
		out.print(a[off]);
		for(int i=off+1; i<len; i++){
			out.print(delim);
			out.print(a[i]);
		}
		out.println("");
		out.flush();
	} output {
		out.print(a[off]);
		for(int i=off+1; i<len; i++){
			out.print(delim);
			out.print(a[i]);
		}
		out.println("");
		out.flush();
	} out.print(a[off]) out.print out a[off] a off for(int i=off+1; i<len; i++){
			out.print(delim);
			out.print(a[i]);
		} int i=off+1; int i=off+1; i off+1 off 1 i<len i len i++ i++ i {
			out.print(delim);
			out.print(a[i]);
		} {
			out.print(delim);
			out.print(a[i]);
		} out.print(delim) out.print out delim out.print(a[i]) out.print out a[i] a i out.println("") out.println out "" out.flush() out.flush out PrintWriter out out int[] a a int off off int len len String delim delim public class Main {
	
	public static void main(String[] args) throws IOException {
		Main m = new Main();
		//*
		m.input();
		m.solve();
		m.output();
		/*/
		m.debug();
		//*/
	}
	
	
	public void debug() {
	}
	InputUtil in = new InputUtil();
	PrintWriter out = new PrintWriter(System.out);
	
	String S,T;
	boolean ans = false;
			
	public void input() throws IOException {
		S = in.nextLine();
		T = in.nextLine();
	}
	
	public void solve() throws IOException {
		for (int i=0; i<S.length(); i++) {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		}
	}
	
	private String solveSub(String s) {
		return s.substring(s.length()-1)+s.substring(0,s.length()-1);
	}
	
	public void output() {
		out.println(ans?"Yes":"No");
		out.flush();
	}
	
} public class Main {
	
	public static void main(String[] args) throws IOException {
		Main m = new Main();
		//*
		m.input();
		m.solve();
		m.output();
		/*/
		m.debug();
		//*/
	}
	
	
	public void debug() {
	}
	InputUtil in = new InputUtil();
	PrintWriter out = new PrintWriter(System.out);
	
	String S,T;
	boolean ans = false;
			
	public void input() throws IOException {
		S = in.nextLine();
		T = in.nextLine();
	}
	
	public void solve() throws IOException {
		for (int i=0; i<S.length(); i++) {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		}
	}
	
	private String solveSub(String s) {
		return s.substring(s.length()-1)+s.substring(0,s.length()-1);
	}
	
	public void output() {
		out.println(ans?"Yes":"No");
		out.flush();
	}
	
} Main
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;


public class Main {
	
	public static void main(String[] args) throws IOException {
		Main m = new Main();
		//*
		m.input();
		m.solve();
		m.output();
		/*/
		m.debug();
		//*/
	}
	
	
	public void debug() {
	}
	InputUtil in = new InputUtil();
	PrintWriter out = new PrintWriter(System.out);
	
	String S,T;
	boolean ans = false;
			
	public void input() throws IOException {
		S = in.nextLine();
		T = in.nextLine();
	}
	
	public void solve() throws IOException {
		for (int i=0; i<S.length(); i++) {
			S = solveSub(S);
			if (S.equals(T)) {
				ans = true;
				break;
			}
		}
	}
	
	private String solveSub(String s) {
		return s.substring(s.length()-1)+s.substring(0,s.length()-1);
	}
	
	public void output() {
		out.println(ans?"Yes":"No");
		out.flush();
	}
	
}

class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 100000;
	boolean lineMode = false;
	
	//Fields
	protected InputStream in;
	private byte[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private DataInputStream dis = null;
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
	protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		}
	}
	
	
	//String Input Reader/Parser
	private boolean isCrLf(byte b) {return b == 0x0a || b == 0x0d; }
	
	private void skipOneCrLf() throws IOException {
		byte b = buf[ptr];
		if (isCrLf(b)) {
			ptr++;
			if (b == 0x0d) {
				readBuf();
				if (ptr < max && buf[ptr] == 0x0a) {
					ptr++;
				}
			}
		}
	}
	
	public String nextLine() throws IOException {
		StringBuilder sb = new StringBuilder();
		boolean isFirst = true;
		for(readBuf(); ptr < max ;readBuf()) {
			byte b = buf[ptr];
			if(isCrLf(b)) {
				skipOneCrLf();
				if (!isFirst || lineMode) {
					break;
				}
			}else{
				int strPtr = ptr++;
				int endPtr = -1;
				for(int i = ptr; i<max; i++) {
					if(isCrLf(buf[i])) {
						endPtr = i;
						break;
					}
				}
				if(endPtr == -1) endPtr = max;
				sb.append(new String(buf,strPtr,endPtr-strPtr,"UTF-8"));
				ptr = endPtr;
			}
			isFirst = false;
		}
		lineMode = true;
		return sb.toString();
	}
	
	public byte nextByte() throws IOException {
		lineMode=false;
		readBuf();
		if(ptr < max) {
			return buf[ptr++];
		}else{
			return -1;
		}
	}
	
	//Number Input Reader/Parser
	private boolean isNum(byte b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(byte b) {return b=='-'; }
	
	public int nextInt() throws IOException {
		lineMode=false;
		readBuf();
		return (int)_nextLong();
	}
	
	public int[] nextInt(int[] result) throws IOException {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = (int)_nextLong();
		}
		return result;
	}
	
	private long _nextLong() throws IOException {
		int sign = 1;
		long res = 0;
		byte c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public long nextLong() throws IOException {
		lineMode=false;
		readBuf();
		return _nextLong();
	}
	
	public long[] nextLong(long[] result) throws IOException {
		lineMode=false;
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextLong();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}

}

class OutputUtil {
	public static final String EOF = System.lineSeparator();

	public static void outputDivSpace(PrintWriter out, int[] a) {
		OutputUtil.output(out,a,0,a.length," ");
	}
	
	public static void outputDivEOF(PrintWriter out, int[] a) {
		OutputUtil.output(out,a,0,a.length,EOF);
	}
	
	public static void output(PrintWriter out, int[] a, int off, int len, String delim) {
		out.print(a[off]);
		for(int i=off+1; i<len; i++){
			out.print(delim);
			out.print(a[i]);
		}
		out.println("");
		out.flush();
	}
}
