import java.util.Scanner;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        String text =scn.next();
        String key = scn.next();
        text+=text;
        String answer = "No";
        for(int i=0; i<(text.length() - key.length()) ; i++){
            String buf = text.substring(i, i+key.length());
            if(buf.equals(key)){
                answer="Yes";
                break;
            }
        }
        System.out.println(answer);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        String text =scn.next();
        String key = scn.next();
        text+=text;
        String answer = "No";
        for(int i=0; i<(text.length() - key.length()) ; i++){
            String buf = text.substring(i, i+key.length());
            if(buf.equals(key)){
                answer="Yes";
                break;
            }
        }
        System.out.println(answer);
    }
} Main public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        String text =scn.next();
        String key = scn.next();
        text+=text;
        String answer = "No";
        for(int i=0; i<(text.length() - key.length()) ; i++){
            String buf = text.substring(i, i+key.length());
            if(buf.equals(key)){
                answer="Yes";
                break;
            }
        }
        System.out.println(answer);
    } main {
        Scanner scn=new Scanner(System.in);
        String text =scn.next();
        String key = scn.next();
        text+=text;
        String answer = "No";
        for(int i=0; i<(text.length() - key.length()) ; i++){
            String buf = text.substring(i, i+key.length());
            if(buf.equals(key)){
                answer="Yes";
                break;
            }
        }
        System.out.println(answer);
    } Scanner scn=new Scanner(System.in); scn new Scanner(System.in) String text =scn.next(); text scn.next() scn.next scn String key = scn.next(); key scn.next() scn.next scn text+=text text text String answer = "No"; answer "No" for(int i=0; i<(text.length() - key.length()) ; i++){
            String buf = text.substring(i, i+key.length());
            if(buf.equals(key)){
                answer="Yes";
                break;
            }
        } int i=0; int i=0; i 0 i<(text.length() - key.length()) i (text.length() - key.length()) text.length() text.length text key.length() key.length key i++ i++ i {
            String buf = text.substring(i, i+key.length());
            if(buf.equals(key)){
                answer="Yes";
                break;
            }
        } {
            String buf = text.substring(i, i+key.length());
            if(buf.equals(key)){
                answer="Yes";
                break;
            }
        } String buf = text.substring(i, i+key.length()); buf text.substring(i, i+key.length()) text.substring text i i+key.length() i key.length() key.length key if(buf.equals(key)){
                answer="Yes";
                break;
            } buf.equals(key) buf.equals buf key {
                answer="Yes";
                break;
            } answer="Yes" answer "Yes" break; System.out.println(answer) System.out.println System.out System System.out answer String arg[] arg
import java.util.Scanner;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        String text =scn.next();
        String key = scn.next();
        text+=text;
        String answer = "No";
        for(int i=0; i<(text.length() - key.length()) ; i++){
            String buf = text.substring(i, i+key.length());
            if(buf.equals(key)){
                answer="Yes";
                break;
            }
        }
        System.out.println(answer);
    }
}