import java.util.*;
import java.lang.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        boolean ans = false;
        
        s = s + s;
        
        if (s.indexOf(p) >= 0) {
            ans = true;
        }
            
        System.out.println(ans?"Yes":"No");
    }
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        boolean ans = false;
        
        s = s + s;
        
        if (s.indexOf(p) >= 0) {
            ans = true;
        }
            
        System.out.println(ans?"Yes":"No");
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        boolean ans = false;
        
        s = s + s;
        
        if (s.indexOf(p) >= 0) {
            ans = true;
        }
            
        System.out.println(ans?"Yes":"No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        boolean ans = false;
        
        s = s + s;
        
        if (s.indexOf(p) >= 0) {
            ans = true;
        }
            
        System.out.println(ans?"Yes":"No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc boolean ans = false; ans false s = s + s s s + s s s if (s.indexOf(p) >= 0) {
            ans = true;
        } s.indexOf(p) >= 0 s.indexOf(p) s.indexOf s p 0 {
            ans = true;
        } ans = true ans true System.out.println(ans?"Yes":"No") System.out.println System.out System System.out ans?"Yes":"No" ans "Yes" "No" String args[] args public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        boolean ans = false;
        
        s = s + s;
        
        if (s.indexOf(p) >= 0) {
            ans = true;
        }
            
        System.out.println(ans?"Yes":"No");
    }
} public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        boolean ans = false;
        
        s = s + s;
        
        if (s.indexOf(p) >= 0) {
            ans = true;
        }
            
        System.out.println(ans?"Yes":"No");
    }
} Main
import java.util.*;
import java.lang.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        boolean ans = false;
        
        s = s + s;
        
        if (s.indexOf(p) >= 0) {
            ans = true;
        }
            
        System.out.println(ans?"Yes":"No");
    }
}
