import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");

        String s = sc.next();
        String p = sc.next();
        String ss = s.concat(s);
        if (ss.indexOf(p) != -1)
            pw.println("Yes");
        else
            pw.println("No");
        
        pw.flush();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");

        String s = sc.next();
        String p = sc.next();
        String ss = s.concat(s);
        if (ss.indexOf(p) != -1)
            pw.println("Yes");
        else
            pw.println("No");
        
        pw.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");

        String s = sc.next();
        String p = sc.next();
        String ss = s.concat(s);
        if (ss.indexOf(p) != -1)
            pw.println("Yes");
        else
            pw.println("No");
        
        pw.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");

        String s = sc.next();
        String p = sc.next();
        String ss = s.concat(s);
        if (ss.indexOf(p) != -1)
            pw.println("Yes");
        else
            pw.println("No");
        
        pw.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc String ss = s.concat(s); ss s.concat(s) s.concat s s if (ss.indexOf(p) != -1)
            pw.println("Yes");
        else
            pw.println("No"); ss.indexOf(p) != -1 ss.indexOf(p) ss.indexOf ss p -1 1 pw.println("Yes") pw.println pw "Yes" pw.println("No") pw.println pw "No" pw.flush() pw.flush pw String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");

        String s = sc.next();
        String p = sc.next();
        String ss = s.concat(s);
        if (ss.indexOf(p) != -1)
            pw.println("Yes");
        else
            pw.println("No");
        
        pw.flush();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");

        String s = sc.next();
        String p = sc.next();
        String ss = s.concat(s);
        if (ss.indexOf(p) != -1)
            pw.println("Yes");
        else
            pw.println("No");
        
        pw.flush();
    }
} Main
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
//        sc.useDelimiter("\n");

        String s = sc.next();
        String p = sc.next();
        String ss = s.concat(s);
        if (ss.indexOf(p) != -1)
            pw.println("Yes");
        else
            pw.println("No");
        
        pw.flush();
    }
}
