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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String S = sc.next();
        String p = sc.next();

        String S2 = S + S;
        boolean result = false;
        for (int i = 0; i < S2.length() - p.length() + 1; i++) {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        }
        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String S = sc.next();
        String p = sc.next();

        String S2 = S + S;
        boolean result = false;
        for (int i = 0; i < S2.length() - p.length() + 1; i++) {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        }
        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String S = sc.next();
        String p = sc.next();

        String S2 = S + S;
        boolean result = false;
        for (int i = 0; i < S2.length() - p.length() + 1; i++) {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        }
        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String S = sc.next();
        String p = sc.next();

        String S2 = S + S;
        boolean result = false;
        for (int i = 0; i < S2.length() - p.length() + 1; i++) {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        }
        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out 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 S2 = S + S; S2 S + S S S boolean result = false; result false for (int i = 0; i < S2.length() - p.length() + 1; i++) {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < S2.length() - p.length() + 1 i S2.length() - p.length() + 1 S2.length() - p.length() S2.length() S2.length S2 p.length() p.length p 1 i++ i++ i {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        } {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        } if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            } S2.substring(i).startsWith(p) S2.substring(i).startsWith S2.substring(i) S2.substring S2 i p {
                result = true;
                break;
            } result = true result true break; if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        } result {
            out.printf("Yes\n");
        } out.printf("Yes\n") out.printf out "Yes\n" {
            out.printf("No\n");
        } out.printf("No\n") out.printf out "No\n" out.flush() out.flush out String[] args args
import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String S = sc.next();
        String p = sc.next();

        String S2 = S + S;
        boolean result = false;
        for (int i = 0; i < S2.length() - p.length() + 1; i++) {
            if (S2.substring(i).startsWith(p)) {
                result = true;
                break;
            }
        }
        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    }
}
