
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.nextLine();
		String p = stdIn.nextLine();
		int y = -1;
		
		
		for(int j=0;j<s.length();j++){
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		}
		
		if(y==1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		
	}
	 static int func(String s ,String p ,int i ,int j ,int count){
		int p_count = (i+1)%p.length();
		int s_count = (j+1)%s.length();
		int ans = 0;
		
		if(count == p.length()){
			ans = 1;
		}
		else if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		}
		 
		 return ans;
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.nextLine();
		String p = stdIn.nextLine();
		int y = -1;
		
		
		for(int j=0;j<s.length();j++){
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		}
		
		if(y==1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		
	}
	 static int func(String s ,String p ,int i ,int j ,int count){
		int p_count = (i+1)%p.length();
		int s_count = (j+1)%s.length();
		int ans = 0;
		
		if(count == p.length()){
			ans = 1;
		}
		else if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		}
		 
		 return ans;
	}

} Main public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.nextLine();
		String p = stdIn.nextLine();
		int y = -1;
		
		
		for(int j=0;j<s.length();j++){
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		}
		
		if(y==1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.nextLine();
		String p = stdIn.nextLine();
		int y = -1;
		
		
		for(int j=0;j<s.length();j++){
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		}
		
		if(y==1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String s = stdIn.nextLine(); s stdIn.nextLine() stdIn.nextLine stdIn String p = stdIn.nextLine(); p stdIn.nextLine() stdIn.nextLine stdIn int y = -1; y -1 1 for(int j=0;j<s.length();j++){
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		} int j=0; int j=0; j 0 j<s.length() j s.length() s.length s j++ j++ j {
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		} {
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		} if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			} s.charAt(j) == p.charAt(0) s.charAt(j) s.charAt s j p.charAt(0) p.charAt p 0 {
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			} int count = 1; count 1 int i = 0; i 0 y = func(s,p,i,j,count) y func(s,p,i,j,count) func s p i j count if(y==1){
				break;
			} y==1 y 1 {
				break;
			} break; if(y==1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		} y==1 y 1 {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args static int func(String s ,String p ,int i ,int j ,int count){
		int p_count = (i+1)%p.length();
		int s_count = (j+1)%s.length();
		int ans = 0;
		
		if(count == p.length()){
			ans = 1;
		}
		else if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		}
		 
		 return ans;
	} func {
		int p_count = (i+1)%p.length();
		int s_count = (j+1)%s.length();
		int ans = 0;
		
		if(count == p.length()){
			ans = 1;
		}
		else if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		}
		 
		 return ans;
	} int p_count = (i+1)%p.length(); p_count (i+1)%p.length() (i+1) i 1 p.length() p.length p int s_count = (j+1)%s.length(); s_count (j+1)%s.length() (j+1) j 1 s.length() s.length s int ans = 0; ans 0 if(count == p.length()){
			ans = 1;
		}
		else if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		} count == p.length() count p.length() p.length p {
			ans = 1;
		} ans = 1 ans 1 if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		} s.charAt(s_count) == p.charAt(p_count) s.charAt(s_count) s.charAt s s_count p.charAt(p_count) p.charAt p p_count {
				count++;
				ans = func(s,p,p_count,s_count,count);
			} count++ count ans = func(s,p,p_count,s_count,count) ans func(s,p,p_count,s_count,count) func s p p_count s_count count {
			ans = -1;
		} ans = -1 ans -1 1 return ans; ans String s s String p p int i i int j j int count count public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.nextLine();
		String p = stdIn.nextLine();
		int y = -1;
		
		
		for(int j=0;j<s.length();j++){
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		}
		
		if(y==1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		
	}
	 static int func(String s ,String p ,int i ,int j ,int count){
		int p_count = (i+1)%p.length();
		int s_count = (j+1)%s.length();
		int ans = 0;
		
		if(count == p.length()){
			ans = 1;
		}
		else if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		}
		 
		 return ans;
	}

} public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.nextLine();
		String p = stdIn.nextLine();
		int y = -1;
		
		
		for(int j=0;j<s.length();j++){
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		}
		
		if(y==1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		
	}
	 static int func(String s ,String p ,int i ,int j ,int count){
		int p_count = (i+1)%p.length();
		int s_count = (j+1)%s.length();
		int ans = 0;
		
		if(count == p.length()){
			ans = 1;
		}
		else if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		}
		 
		 return ans;
	}

} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.nextLine();
		String p = stdIn.nextLine();
		int y = -1;
		
		
		for(int j=0;j<s.length();j++){
			if(s.charAt(j) == p.charAt(0)){
				int count = 1;
				int i = 0;
				y = func(s,p,i,j,count);
			}
			if(y==1){
				break;
			}
		}
		
		if(y==1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		
	}
	 static int func(String s ,String p ,int i ,int j ,int count){
		int p_count = (i+1)%p.length();
		int s_count = (j+1)%s.length();
		int ans = 0;
		
		if(count == p.length()){
			ans = 1;
		}
		else if(s.charAt(s_count) == p.charAt(p_count)){
				count++;
				ans = func(s,p,p_count,s_count,count);
			}
		else{
			ans = -1;
		}
		 
		 return ans;
	}

}