import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String ring=br.readLine();
        String key=br.readLine();
        for(int i=0;i<ring.length();i++){
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }System.out.println("No");
    }
} import java.io.*; io.* java import java.util.*; util.* java class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String ring=br.readLine();
        String key=br.readLine();
        for(int i=0;i<ring.length();i++){
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }System.out.println("No");
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String ring=br.readLine();
        String key=br.readLine();
        for(int i=0;i<ring.length();i++){
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }System.out.println("No");
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String ring=br.readLine();
        String key=br.readLine();
        for(int i=0;i<ring.length();i++){
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }System.out.println("No");
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String ring=br.readLine(); ring br.readLine() br.readLine br String key=br.readLine(); key br.readLine() br.readLine br for(int i=0;i<ring.length();i++){
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        } int i=0; int i=0; i 0 i<ring.length() i ring.length() ring.length ring i++ i++ i {
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        } {
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        } if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            } ring.charAt(i)==key.charAt(0) ring.charAt(i) ring.charAt ring i key.charAt(0) key.charAt key 0 {
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            } int root=i; root i int j=0; j 0 while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                } j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j) j<key.length() j key.length() key.length key ring.charAt(root%ring.length())==key.charAt(j) ring.charAt(root%ring.length()) ring.charAt ring root%ring.length() root ring.length() ring.length ring key.charAt(j) key.charAt key j {
                    j++;
                    root++;
                } j++ j root++ root if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                } j==key.length() j key.length() key.length key {
                    System.out.println("Yes");
                    System.exit(0);
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String ring=br.readLine();
        String key=br.readLine();
        for(int i=0;i<ring.length();i++){
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }System.out.println("No");
    }
}