import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		String s;
		String p;
		StringBuilder ling = new StringBuilder();
		final int MAX_LENGTH = 100;

		Scanner stdIn = new Scanner(System.in);

		s = stdIn.nextLine();
		p = stdIn.nextLine();

		while(ling.length() <= MAX_LENGTH) {
			ling.append(s);
		}

		if(ling.indexOf(p) == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}

	}

} import java.util.Scanner; Scanner java.util class Main {

	public static void main(String[] args) {

		String s;
		String p;
		StringBuilder ling = new StringBuilder();
		final int MAX_LENGTH = 100;

		Scanner stdIn = new Scanner(System.in);

		s = stdIn.nextLine();
		p = stdIn.nextLine();

		while(ling.length() <= MAX_LENGTH) {
			ling.append(s);
		}

		if(ling.indexOf(p) == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}

	}

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

		String s;
		String p;
		StringBuilder ling = new StringBuilder();
		final int MAX_LENGTH = 100;

		Scanner stdIn = new Scanner(System.in);

		s = stdIn.nextLine();
		p = stdIn.nextLine();

		while(ling.length() <= MAX_LENGTH) {
			ling.append(s);
		}

		if(ling.indexOf(p) == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}

	} main {

		String s;
		String p;
		StringBuilder ling = new StringBuilder();
		final int MAX_LENGTH = 100;

		Scanner stdIn = new Scanner(System.in);

		s = stdIn.nextLine();
		p = stdIn.nextLine();

		while(ling.length() <= MAX_LENGTH) {
			ling.append(s);
		}

		if(ling.indexOf(p) == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}

	} String s; s String p; p StringBuilder ling = new StringBuilder(); ling new StringBuilder() final int MAX_LENGTH = 100; MAX_LENGTH 100 Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) s = stdIn.nextLine() s stdIn.nextLine() stdIn.nextLine stdIn p = stdIn.nextLine() p stdIn.nextLine() stdIn.nextLine stdIn while(ling.length() <= MAX_LENGTH) {
			ling.append(s);
		} ling.length() <= MAX_LENGTH ling.length() ling.length ling MAX_LENGTH {
			ling.append(s);
		} ling.append(s) ling.append ling s if(ling.indexOf(p) == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		} ling.indexOf(p) == -1 ling.indexOf(p) ling.indexOf ling p -1 1 {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		String s;
		String p;
		StringBuilder ling = new StringBuilder();
		final int MAX_LENGTH = 100;

		Scanner stdIn = new Scanner(System.in);

		s = stdIn.nextLine();
		p = stdIn.nextLine();

		while(ling.length() <= MAX_LENGTH) {
			ling.append(s);
		}

		if(ling.indexOf(p) == -1) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}

	}

}