import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words, sentence;
        sentence = scan.next();
        words = scan.next();
        int result;
        
        sentence+=sentence;
        if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words, sentence;
        sentence = scan.next();
        words = scan.next();
        int result;
        
        sentence+=sentence;
        if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} Main public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words, sentence;
        sentence = scan.next();
        words = scan.next();
        int result;
        
        sentence+=sentence;
        if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No");
    } main {
        Scanner scan=new Scanner(System.in);
        String words, sentence;
        sentence = scan.next();
        words = scan.next();
        int result;
        
        sentence+=sentence;
        if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No");
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String words words sentence; sentence sentence = scan.next() sentence scan.next() scan.next scan words = scan.next() words scan.next() scan.next scan int result; result sentence+=sentence sentence sentence if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No"); sentence.indexOf(words)!=-1 sentence.indexOf(words) sentence.indexOf sentence words -1 1 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 public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words, sentence;
        sentence = scan.next();
        words = scan.next();
        int result;
        
        sentence+=sentence;
        if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words, sentence;
        sentence = scan.next();
        words = scan.next();
        int result;
        
        sentence+=sentence;
        if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words, sentence;
        sentence = scan.next();
        words = scan.next();
        int result;
        
        sentence+=sentence;
        if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}
