import java.util.*;
 
class Main{
    public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		StringBuffer sb = new StringBuffer(scan.next());
		String str = scan.next();

		sb.append(sb);
		int a = sb.indexOf(str);
		if(a != -1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		StringBuffer sb = new StringBuffer(scan.next());
		String str = scan.next();

		sb.append(sb);
		int a = sb.indexOf(str);
		if(a != -1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
    }
} Main public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		StringBuffer sb = new StringBuffer(scan.next());
		String str = scan.next();

		sb.append(sb);
		int a = sb.indexOf(str);
		if(a != -1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
    } main {
		
		Scanner scan = new Scanner(System.in);
		StringBuffer sb = new StringBuffer(scan.next());
		String str = scan.next();

		sb.append(sb);
		int a = sb.indexOf(str);
		if(a != -1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) StringBuffer sb = new StringBuffer(scan.next()); sb new StringBuffer(scan.next()) String str = scan.next(); str scan.next() scan.next scan sb.append(sb) sb.append sb sb int a = sb.indexOf(str); a sb.indexOf(str) sb.indexOf sb str if(a != -1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		} a != -1 a -1 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
import java.util.*;
 
class Main{
    public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		StringBuffer sb = new StringBuffer(scan.next());
		String str = scan.next();

		sb.append(sb);
		int a = sb.indexOf(str);
		if(a != -1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
    }
}