import java.util.*;

public class Main {
    static int modP = 1000000007;
    static long inf  = 1 << 61;
    static int[] x4 = {-1, 0, 0, 1};
    static int[] y4 = {0, -1, 1, 0};

    static String s, t;

    public static void main(String[] args) {
        input();
        solve();
    }

    static void solve() {
        s = s + s + s;
        int l = t.length();
        for(int i = 0; i < l; i++) {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        }

        print("No");
    }

    static void input() {
        Scanner in = new Scanner(System.in);
        s = in.next();
        t = in.next();
    }

    static void print(String s) {
        System.out.println(s);
    }

    static void print(char c) {
        System.out.println(c);
    }

    static void print(int i) {
        System.out.println(i);
    }

    static void print(long i) {
        System.out.println(i);
    }

    static void print(float i) {
        System.out.println(i);
    }

    static void printArray2D(int[][] array, char del) {
        int r = array.length;
        int c = array[0].length;
        for(int i = 0; i < r; i++) {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        }
    }
} import java.util.*; util.* java public class Main {
    static int modP = 1000000007;
    static long inf  = 1 << 61;
    static int[] x4 = {-1, 0, 0, 1};
    static int[] y4 = {0, -1, 1, 0};

    static String s, t;

    public static void main(String[] args) {
        input();
        solve();
    }

    static void solve() {
        s = s + s + s;
        int l = t.length();
        for(int i = 0; i < l; i++) {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        }

        print("No");
    }

    static void input() {
        Scanner in = new Scanner(System.in);
        s = in.next();
        t = in.next();
    }

    static void print(String s) {
        System.out.println(s);
    }

    static void print(char c) {
        System.out.println(c);
    }

    static void print(int i) {
        System.out.println(i);
    }

    static void print(long i) {
        System.out.println(i);
    }

    static void print(float i) {
        System.out.println(i);
    }

    static void printArray2D(int[][] array, char del) {
        int r = array.length;
        int c = array[0].length;
        for(int i = 0; i < r; i++) {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        }
    }
} Main static int modP = 1000000007; modP 1000000007 static long inf  = 1 << 61; inf 1 << 61 1 61 static int[] x4 = {-1, 0, 0, 1}; x4 {-1, 0, 0, 1} -1 1 0 0 1 static int[] y4 = {0, -1, 1, 0}; y4 {0, -1, 1, 0} 0 -1 1 1 0 static String s s t; t public static void main(String[] args) {
        input();
        solve();
    } main {
        input();
        solve();
    } input() input solve() solve String[] args args static void solve() {
        s = s + s + s;
        int l = t.length();
        for(int i = 0; i < l; i++) {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        }

        print("No");
    } solve {
        s = s + s + s;
        int l = t.length();
        for(int i = 0; i < l; i++) {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        }

        print("No");
    } s = s + s + s s s + s + s s + s + s s s s int l = t.length(); l t.length() t.length t for(int i = 0; i < l; i++) {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        } {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        } if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            } s.substring(i, i+l).equals(t) s.substring(i, i+l).equals s.substring(i, i+l) s.substring s i i+l i l t {
                print("Yes");
                return;
            } print("Yes") print "Yes" return; print("No") print "No" static void input() {
        Scanner in = new Scanner(System.in);
        s = in.next();
        t = in.next();
    } input {
        Scanner in = new Scanner(System.in);
        s = in.next();
        t = in.next();
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) s = in.next() s in.next() in.next in t = in.next() t in.next() in.next in static void print(String s) {
        System.out.println(s);
    } print {
        System.out.println(s);
    } System.out.println(s) System.out.println System.out System System.out s String s s static void print(char c) {
        System.out.println(c);
    } print {
        System.out.println(c);
    } System.out.println(c) System.out.println System.out System System.out c char c c static void print(int i) {
        System.out.println(i);
    } print {
        System.out.println(i);
    } System.out.println(i) System.out.println System.out System System.out i int i i static void print(long i) {
        System.out.println(i);
    } print {
        System.out.println(i);
    } System.out.println(i) System.out.println System.out System System.out i long i i static void print(float i) {
        System.out.println(i);
    } print {
        System.out.println(i);
    } System.out.println(i) System.out.println System.out System System.out i float i i static void printArray2D(int[][] array, char del) {
        int r = array.length;
        int c = array[0].length;
        for(int i = 0; i < r; i++) {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        }
    } printArray2D {
        int r = array.length;
        int c = array[0].length;
        for(int i = 0; i < r; i++) {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        }
    } int r = array.length; r array.length array array.length int c = array[0].length; c array[0].length array[0] array 0 array[0].length for(int i = 0; i < r; i++) {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        } int i = 0; int i = 0; i 0 i < r i r i++ i++ i {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        } {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        } for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            } int j = 0; int j = 0; j 0 j < c j c j++ j++ j {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            } {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            } System.out.format("%3d", array[i][j]) System.out.format System.out System System.out "%3d" array[i][j] array[i] array i j if(j != c-1) System.out.print(del);
                else System.out.print('\n'); j != c-1 j c-1 c 1 System.out.print(del) System.out.print System.out System System.out del System.out.print('\n') System.out.print System.out System System.out '\n' int[][] array array char del del public class Main {
    static int modP = 1000000007;
    static long inf  = 1 << 61;
    static int[] x4 = {-1, 0, 0, 1};
    static int[] y4 = {0, -1, 1, 0};

    static String s, t;

    public static void main(String[] args) {
        input();
        solve();
    }

    static void solve() {
        s = s + s + s;
        int l = t.length();
        for(int i = 0; i < l; i++) {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        }

        print("No");
    }

    static void input() {
        Scanner in = new Scanner(System.in);
        s = in.next();
        t = in.next();
    }

    static void print(String s) {
        System.out.println(s);
    }

    static void print(char c) {
        System.out.println(c);
    }

    static void print(int i) {
        System.out.println(i);
    }

    static void print(long i) {
        System.out.println(i);
    }

    static void print(float i) {
        System.out.println(i);
    }

    static void printArray2D(int[][] array, char del) {
        int r = array.length;
        int c = array[0].length;
        for(int i = 0; i < r; i++) {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        }
    }
} public class Main {
    static int modP = 1000000007;
    static long inf  = 1 << 61;
    static int[] x4 = {-1, 0, 0, 1};
    static int[] y4 = {0, -1, 1, 0};

    static String s, t;

    public static void main(String[] args) {
        input();
        solve();
    }

    static void solve() {
        s = s + s + s;
        int l = t.length();
        for(int i = 0; i < l; i++) {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        }

        print("No");
    }

    static void input() {
        Scanner in = new Scanner(System.in);
        s = in.next();
        t = in.next();
    }

    static void print(String s) {
        System.out.println(s);
    }

    static void print(char c) {
        System.out.println(c);
    }

    static void print(int i) {
        System.out.println(i);
    }

    static void print(long i) {
        System.out.println(i);
    }

    static void print(float i) {
        System.out.println(i);
    }

    static void printArray2D(int[][] array, char del) {
        int r = array.length;
        int c = array[0].length;
        for(int i = 0; i < r; i++) {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        }
    }
} Main
import java.util.*;

public class Main {
    static int modP = 1000000007;
    static long inf  = 1 << 61;
    static int[] x4 = {-1, 0, 0, 1};
    static int[] y4 = {0, -1, 1, 0};

    static String s, t;

    public static void main(String[] args) {
        input();
        solve();
    }

    static void solve() {
        s = s + s + s;
        int l = t.length();
        for(int i = 0; i < l; i++) {
            if(s.substring(i, i+l).equals(t)) {
                print("Yes");
                return;
            }
        }

        print("No");
    }

    static void input() {
        Scanner in = new Scanner(System.in);
        s = in.next();
        t = in.next();
    }

    static void print(String s) {
        System.out.println(s);
    }

    static void print(char c) {
        System.out.println(c);
    }

    static void print(int i) {
        System.out.println(i);
    }

    static void print(long i) {
        System.out.println(i);
    }

    static void print(float i) {
        System.out.println(i);
    }

    static void printArray2D(int[][] array, char del) {
        int r = array.length;
        int c = array[0].length;
        for(int i = 0; i < r; i++) {
            for(int j = 0; j < c; j++) {
                System.out.format("%3d", array[i][j]);
                if(j != c-1) System.out.print(del);
                else System.out.print('\n');
            }
        }
    }
}