import java.io.InputStreamReader;
import java.io.LineNumberReader;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D
 * 
 * @author eitatsuro
 * 
 */
public class Main {
    
    public static void main(String[] args) {
        try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    }
} import java.io.InputStreamReader; InputStreamReader java.io import java.io.LineNumberReader; LineNumberReader java.io public class Main {
    
    public static void main(String[] args) {
        try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    }
} Main public static void main(String[] args) {
        try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    } main {
        try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    } try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } catch (Exception e) {
            System.exit(-1);
        } catch (Exception e) {
            System.exit(-1);
        } Exception e {
            System.exit(-1);
        } System.exit(-1) System.exit System -1 1 {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in)); lineNumReader new LineNumberReader(
                    new InputStreamReader(System.in)) String inputStr = null; inputStr null String s = null; s null String p = null; p null boolean answer = false; answer false while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            } (inputStr = lineNumReader.readLine()) != null (inputStr = lineNumReader.readLine()) inputStr lineNumReader.readLine() lineNumReader.readLine lineNumReader null {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            } if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                } lineNumReader.getLineNumber() == 1 lineNumReader.getLineNumber() lineNumReader.getLineNumber lineNumReader 1 {
                    s = inputStr;
                } s = inputStr s inputStr if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                } lineNumReader.getLineNumber() == 2 lineNumReader.getLineNumber() lineNumReader.getLineNumber lineNumReader 2 {
                    p = inputStr;
                    break;
                } p = inputStr p inputStr break; StringBuilder longS = new StringBuilder(); longS new StringBuilder() for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            } int i=0; int i=0; i 0 i < 2+ p.length()/s.length() i 2+ p.length()/s.length() 2 p.length()/s.length() p.length() p.length p s.length() s.length s i++ i++ i {
                longS.append(s);
            } {
                longS.append(s);
            } longS.append(s) longS.append longS s if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            } longS.indexOf(p) <= -1 longS.indexOf(p) longS.indexOf longS p -1 1 {
                answer = false;
            } answer = false answer false {
                answer = true;
            } answer = true answer true if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            } answer {
                 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" lineNumReader.close() lineNumReader.close lineNumReader String[] args args public class Main {
    
    public static void main(String[] args) {
        try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    }
} public class Main {
    
    public static void main(String[] args) {
        try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    }
} Main
import java.io.InputStreamReader;
import java.io.LineNumberReader;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D
 * 
 * @author eitatsuro
 * 
 */
public class Main {
    
    public static void main(String[] args) {
        try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));

            String inputStr = null;
            String s = null;
            String p = null;
            boolean answer = false;
            
            while ((inputStr = lineNumReader.readLine()) != null) {

                if (lineNumReader.getLineNumber() == 1) {
                    s = inputStr;
                }
                
                if (lineNumReader.getLineNumber() == 2) {
                    p = inputStr;
                    break;
                }
            }

            // p???s??????????????????????????????.
            // ?????????p????????????s?????°??±???????????????????????§??????????????§???
            // ?????????p??¨s??????????????????????????????
            // ?????????????????????s??????????????????
            StringBuilder longS = new StringBuilder();
            for ( int i=0; i < 2+ p.length()/s.length(); i++){
                longS.append(s);
            }
            

            if (longS.indexOf(p) <= -1) {
                answer = false;
            } else {
                answer = true;
            }

            
            // ??¢???????????????
            if (answer) {
                 System.out.println("Yes");
            } else {
                System.out.println("No");
            }

            lineNumReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    }
}