import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        int end = 0;
        int cnt = 0;
        int j = 0;
        for (int i = 0; i < p.length(); i++) {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        }

    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        int end = 0;
        int cnt = 0;
        int j = 0;
        for (int i = 0; i < p.length(); i++) {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        }

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        int end = 0;
        int cnt = 0;
        int j = 0;
        for (int i = 0; i < p.length(); i++) {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        }

    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        int end = 0;
        int cnt = 0;
        int j = 0;
        for (int i = 0; i < p.length(); i++) {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc int end = 0; end 0 int cnt = 0; cnt 0 int j = 0; j 0 for (int i = 0; i < p.length(); i++) {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        } int i = 0; int i = 0; i 0 i < p.length() i p.length() p.length p i++ i++ i {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        } {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        } if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            } s.charAt(j) == p.charAt(i) s.charAt(j) s.charAt s j p.charAt(i) p.charAt p i {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            } cnt++ cnt if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                } cnt == p.length() cnt p.length() p.length p {
                    System.out.println("Yes");
                    break;
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" break; j++ j if (j == s.length()) {
                j = 0;
            } j == s.length() j s.length() s.length s {
                j = 0;
            } j = 0 j 0 if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            } i == p.length() - 1 i p.length() - 1 p.length() p.length p 1 {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            } i = -1 i -1 1 end++ end j = end j end cnt = 0 cnt 0 if (end == s.length()) {
                    System.out.println("No");
                    break;
                } end == s.length() end s.length() s.length s {
                    System.out.println("No");
                    break;
                } System.out.println("No") System.out.println System.out System System.out "No" break; String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        int end = 0;
        int cnt = 0;
        int j = 0;
        for (int i = 0; i < p.length(); i++) {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        }

    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        int end = 0;
        int cnt = 0;
        int j = 0;
        for (int i = 0; i < p.length(); i++) {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        }

    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        int end = 0;
        int cnt = 0;
        int j = 0;
        for (int i = 0; i < p.length(); i++) {

            if (s.charAt(j) == p.charAt(i)) {
                cnt++;
                if (cnt == p.length()) {
                    System.out.println("Yes");
                    break;
                }
            }
            j++;
            if (j == s.length()) {
                j = 0;
            }
            if (i == p.length() - 1) {
                i = -1;
                end++;
                j = end;
                cnt = 0;
                if (end == s.length()) {
                    System.out.println("No");
                    break;
                }
            }

        }

    }
}