import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int sBeforeLength = s.length();
        String p = sc.next();
        s = s + s.substring(0, p.length()-1);
        int flag = 1;
        for(int i=0; i<=sBeforeLength-1; i++){
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        }
        if(flag==0) {System.out.println("Yes");}
        else{System.out.println("No");}
    }
} 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();
        int sBeforeLength = s.length();
        String p = sc.next();
        s = s + s.substring(0, p.length()-1);
        int flag = 1;
        for(int i=0; i<=sBeforeLength-1; i++){
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        }
        if(flag==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.next();
        int sBeforeLength = s.length();
        String p = sc.next();
        s = s + s.substring(0, p.length()-1);
        int flag = 1;
        for(int i=0; i<=sBeforeLength-1; i++){
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        }
        if(flag==0) {System.out.println("Yes");}
        else{System.out.println("No");}
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int sBeforeLength = s.length();
        String p = sc.next();
        s = s + s.substring(0, p.length()-1);
        int flag = 1;
        for(int i=0; i<=sBeforeLength-1; i++){
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        }
        if(flag==0) {System.out.println("Yes");}
        else{System.out.println("No");}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int sBeforeLength = s.length(); sBeforeLength s.length() s.length s String p = sc.next(); p sc.next() sc.next sc s = s + s.substring(0, p.length()-1) s 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 int flag = 1; flag 1 for(int i=0; i<=sBeforeLength-1; i++){
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        } int i=0; int i=0; i 0 i<=sBeforeLength-1 i sBeforeLength-1 sBeforeLength 1 i++ i++ i {
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        } {
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        } if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0; p.equals( s.substring( i, i+p.length() ) ) p.equals p s.substring( i, i+p.length() ) s.substring s i i+p.length() i p.length() p.length p flag=0 flag 0 if(flag==0) {System.out.println("Yes");}
        else{System.out.println("No");} flag==0 flag 0 {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 public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int sBeforeLength = s.length();
        String p = sc.next();
        s = s + s.substring(0, p.length()-1);
        int flag = 1;
        for(int i=0; i<=sBeforeLength-1; i++){
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        }
        if(flag==0) {System.out.println("Yes");}
        else{System.out.println("No");}
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int sBeforeLength = s.length();
        String p = sc.next();
        s = s + s.substring(0, p.length()-1);
        int flag = 1;
        for(int i=0; i<=sBeforeLength-1; i++){
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        }
        if(flag==0) {System.out.println("Yes");}
        else{System.out.println("No");}
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int sBeforeLength = s.length();
        String p = sc.next();
        s = s + s.substring(0, p.length()-1);
        int flag = 1;
        for(int i=0; i<=sBeforeLength-1; i++){
            if( p.equals( s.substring( i, i+p.length() ) ) ) flag=0;
        }
        if(flag==0) {System.out.println("Yes");}
        else{System.out.println("No");}
    }
}
