import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String p, s;
        p= sc.next();
        s= sc.next();
        String st=p+p; 
        int result = st.indexOf(s);
        if(result==-1)System.out.println("No");
        else System.out.println("Yes");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String p, s;
        p= sc.next();
        s= sc.next();
        String st=p+p; 
        int result = st.indexOf(s);
        if(result==-1)System.out.println("No");
        else System.out.println("Yes");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String p, s;
        p= sc.next();
        s= sc.next();
        String st=p+p; 
        int result = st.indexOf(s);
        if(result==-1)System.out.println("No");
        else System.out.println("Yes");
    } main {
        Scanner sc = new Scanner(System.in);
        String p, s;
        p= sc.next();
        s= sc.next();
        String st=p+p; 
        int result = st.indexOf(s);
        if(result==-1)System.out.println("No");
        else System.out.println("Yes");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String p p s; s p= sc.next() p sc.next() sc.next sc s= sc.next() s sc.next() sc.next sc String st=p+p; st p+p p p int result = st.indexOf(s); result st.indexOf(s) st.indexOf st s if(result==-1)System.out.println("No");
        else System.out.println("Yes"); result==-1 result -1 1 System.out.println("No") System.out.println System.out System System.out "No" System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String p, s;
        p= sc.next();
        s= sc.next();
        String st=p+p; 
        int result = st.indexOf(s);
        if(result==-1)System.out.println("No");
        else System.out.println("Yes");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String p, s;
        p= sc.next();
        s= sc.next();
        String st=p+p; 
        int result = st.indexOf(s);
        if(result==-1)System.out.println("No");
        else System.out.println("Yes");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String p, s;
        p= sc.next();
        s= sc.next();
        String st=p+p; 
        int result = st.indexOf(s);
        if(result==-1)System.out.println("No");
        else System.out.println("Yes");
    }
}
