import java.util.*;

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

        String s = sc.nextLine();
        String p = sc.nextLine();

        int num_s = s.length();
        s += s.substring(0,s.length() - 1);
        
        int yes = 0;
        for(int i = 0;i < num_s;i++){
            if((s.substring(i,(p.length() + i))).equals(p)) yes++;
        }

        if(yes > 0) System.out.println("Yes");
        else    System.out.println("No");
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        String p = sc.nextLine();

        int num_s = s.length();
        s += s.substring(0,s.length() - 1);
        
        int yes = 0;
        for(int i = 0;i < num_s;i++){
            if((s.substring(i,(p.length() + i))).equals(p)) yes++;
        }

        if(yes > 0) System.out.println("Yes");
        else    System.out.println("No");
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        String p = sc.nextLine();

        int num_s = s.length();
        s += s.substring(0,s.length() - 1);
        
        int yes = 0;
        for(int i = 0;i < num_s;i++){
            if((s.substring(i,(p.length() + i))).equals(p)) yes++;
        }

        if(yes > 0) System.out.println("Yes");
        else    System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        String p = sc.nextLine();

        int num_s = s.length();
        s += s.substring(0,s.length() - 1);
        
        int yes = 0;
        for(int i = 0;i < num_s;i++){
            if((s.substring(i,(p.length() + i))).equals(p)) yes++;
        }

        if(yes > 0) System.out.println("Yes");
        else    System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc int num_s = s.length(); num_s s.length() s.length s s += s.substring(0,s.length() - 1) s s.substring(0,s.length() - 1) s.substring s 0 s.length() - 1 s.length() s.length s 1 int yes = 0; yes 0 for(int i = 0;i < num_s;i++){
            if((s.substring(i,(p.length() + i))).equals(p)) yes++;
        } int i = 0; int i = 0; i 0 i < num_s i num_s i++ i++ i {
            if((s.substring(i,(p.length() + i))).equals(p)) yes++;
        } {
            if((s.substring(i,(p.length() + i))).equals(p)) yes++;
        } if((s.substring(i,(p.length() + i))).equals(p)) yes++; (s.substring(i,(p.length() + i))).equals(p) (s.substring(i,(p.length() + i))).equals (s.substring(i,(p.length() + i))) s.substring s i (p.length() + i) p.length() p.length p i p yes++ yes if(yes > 0) System.out.println("Yes");
        else    System.out.println("No"); yes > 0 yes 0 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.*;

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

        String s = sc.nextLine();
        String p = sc.nextLine();

        int num_s = s.length();
        s += s.substring(0,s.length() - 1);
        
        int yes = 0;
        for(int i = 0;i < num_s;i++){
            if((s.substring(i,(p.length() + i))).equals(p)) yes++;
        }

        if(yes > 0) System.out.println("Yes");
        else    System.out.println("No");
    }
}
