import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String S,P;
        S = input.next();
        int n = S.length();
        P = input.next();
        boolean ans = false;
        S += S.substring(0,P.length()-1);
        for (int i = 0; i < n; i++){
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        }
        if (ans){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} import java.util.*; util.* java import java.util.stream.*; stream.* java.util class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String S,P;
        S = input.next();
        int n = S.length();
        P = input.next();
        boolean ans = false;
        S += S.substring(0,P.length()-1);
        for (int i = 0; i < n; i++){
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        }
        if (ans){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String S,P;
        S = input.next();
        int n = S.length();
        P = input.next();
        boolean ans = false;
        S += S.substring(0,P.length()-1);
        for (int i = 0; i < n; i++){
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        }
        if (ans){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        Scanner input = new Scanner(System.in);
        String S,P;
        S = input.next();
        int n = S.length();
        P = input.next();
        boolean ans = false;
        S += S.substring(0,P.length()-1);
        for (int i = 0; i < n; i++){
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        }
        if (ans){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) String S S P; P S = input.next() S input.next() input.next input int n = S.length(); n S.length() S.length S P = input.next() P input.next() input.next input boolean ans = false; ans false S += S.substring(0,P.length()-1) S S.substring(0,P.length()-1) S.substring S 0 P.length()-1 P.length() P.length P 1 for (int i = 0; i < n; i++){
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        } {
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        } String tmp = S.substring(i,i+P.length()); tmp S.substring(i,i+P.length()) S.substring S i i+P.length() i P.length() P.length P if (tmp.equals(P)){
                ans = true;
                break;
            } tmp.equals(P) tmp.equals tmp P {
                ans = true;
                break;
            } ans = true ans true break; if (ans){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } ans {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String S,P;
        S = input.next();
        int n = S.length();
        P = input.next();
        boolean ans = false;
        S += S.substring(0,P.length()-1);
        for (int i = 0; i < n; i++){
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        }
        if (ans){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
