public class Main {
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		String s, p;
		
		s = sc.next();
		p = sc.next();
		
		if ((s + s).contains(p)) {
			out.println("Yes");
		} else {
			out.println("No");
		}
	}

	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

} public class Main {
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		String s, p;
		
		s = sc.next();
		p = sc.next();
		
		if ((s + s).contains(p)) {
			out.println("Yes");
		} else {
			out.println("No");
		}
	}

	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

} Main public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		String s, p;
		
		s = sc.next();
		p = sc.next();
		
		if ((s + s).contains(p)) {
			out.println("Yes");
		} else {
			out.println("No");
		}
	} run {
		final java.util.Scanner sc = new java.util.Scanner(in);
		String s, p;
		
		s = sc.next();
		p = sc.next();
		
		if ((s + s).contains(p)) {
			out.println("Yes");
		} else {
			out.println("No");
		}
	} final java.util.Scanner sc = new java.util.Scanner(in); sc new java.util.Scanner(in) String s s p; p s = sc.next() s sc.next() sc.next sc p = sc.next() p sc.next() sc.next sc if ((s + s).contains(p)) {
			out.println("Yes");
		} else {
			out.println("No");
		} (s + s).contains(p) (s + s).contains (s + s) s s p {
			out.println("Yes");
		} out.println("Yes") out.println out "Yes" {
			out.println("No");
		} out.println("No") out.println out "No" java.io.InputStream in in java.io.PrintStream out out public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	} main {
		(new Main()).run(System.in, System.out);
	} (new Main()).run(System.in, System.out) (new Main()).run (new Main()) System.in System System.in System.out System System.out String[] args args public class Main {
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		String s, p;
		
		s = sc.next();
		p = sc.next();
		
		if ((s + s).contains(p)) {
			out.println("Yes");
		} else {
			out.println("No");
		}
	}

	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

} public class Main {
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		String s, p;
		
		s = sc.next();
		p = sc.next();
		
		if ((s + s).contains(p)) {
			out.println("Yes");
		} else {
			out.println("No");
		}
	}

	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

} Main
public class Main {
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		String s, p;
		
		s = sc.next();
		p = sc.next();
		
		if ((s + s).contains(p)) {
			out.println("Yes");
		} else {
			out.println("No");
		}
	}

	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

}