import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main (String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String p = scan.next();
        String judge = "No";
        
        List<Integer> s_markList = new ArrayList<Integer>();


        for (int i = 0; i < s.length(); i++) {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        }
        
   
        Iterator<Integer> it = s_markList.iterator();
        while(it.hasNext()){
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        }
        
        System.out.println(judge);
        
    }
}
 import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main (String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String p = scan.next();
        String judge = "No";
        
        List<Integer> s_markList = new ArrayList<Integer>();


        for (int i = 0; i < s.length(); i++) {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        }
        
   
        Iterator<Integer> it = s_markList.iterator();
        while(it.hasNext()){
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        }
        
        System.out.println(judge);
        
    }
} Main public static void main (String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String p = scan.next();
        String judge = "No";
        
        List<Integer> s_markList = new ArrayList<Integer>();


        for (int i = 0; i < s.length(); i++) {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        }
        
   
        Iterator<Integer> it = s_markList.iterator();
        while(it.hasNext()){
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        }
        
        System.out.println(judge);
        
    } main {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String p = scan.next();
        String judge = "No";
        
        List<Integer> s_markList = new ArrayList<Integer>();


        for (int i = 0; i < s.length(); i++) {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        }
        
   
        Iterator<Integer> it = s_markList.iterator();
        while(it.hasNext()){
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        }
        
        System.out.println(judge);
        
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String p = scan.next(); p scan.next() scan.next scan String judge = "No"; judge "No" List<Integer> s_markList = new ArrayList<Integer>(); s_markList new ArrayList<Integer>() for (int i = 0; i < s.length(); i++) {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        } {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        } if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            } p.charAt(0) == s.charAt(i) p.charAt(0) p.charAt p 0 s.charAt(i) s.charAt s i {
                s_markList.add(i);
            } s_markList.add(i) s_markList.add s_markList i Iterator<Integer> it = s_markList.iterator(); it s_markList.iterator() s_markList.iterator s_markList while(it.hasNext()){
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        } it.hasNext() it.hasNext it {
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        } Integer e =it.next(); e it.next() it.next it String ss = s; ss s if(p.length() > s.length()-e){
                ss = s + s;
             
            } p.length() > s.length()-e p.length() p.length p s.length()-e s.length() s.length s e {
                ss = s + s;
             
            } ss = s + s ss s + s s s int f = 0; f 0 for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            } int i = e; int i = e; i e i < e + p.length() i e + p.length() e p.length() p.length p i++ i++ i {
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            } {
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            } if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                } ss.charAt(i) == p.charAt(f) ss.charAt(i) ss.charAt ss i p.charAt(f) p.charAt p f {

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                } if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    } f == p.length()-1 f p.length()-1 p.length() p.length p 1 {
    
                        judge = "Yes";
                        break;
                    } judge = "Yes" judge "Yes" break; f++ f {
                    break;
                } break; System.out.println(judge) System.out.println System.out System System.out judge String[] args args public class Main {
    public static void main (String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String p = scan.next();
        String judge = "No";
        
        List<Integer> s_markList = new ArrayList<Integer>();


        for (int i = 0; i < s.length(); i++) {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        }
        
   
        Iterator<Integer> it = s_markList.iterator();
        while(it.hasNext()){
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        }
        
        System.out.println(judge);
        
    }
} public class Main {
    public static void main (String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String p = scan.next();
        String judge = "No";
        
        List<Integer> s_markList = new ArrayList<Integer>();


        for (int i = 0; i < s.length(); i++) {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        }
        
   
        Iterator<Integer> it = s_markList.iterator();
        while(it.hasNext()){
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        }
        
        System.out.println(judge);
        
    }
} Main
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main (String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String p = scan.next();
        String judge = "No";
        
        List<Integer> s_markList = new ArrayList<Integer>();


        for (int i = 0; i < s.length(); i++) {
            if(p.charAt(0) == s.charAt(i)){
                s_markList.add(i);
            }
        }
        
   
        Iterator<Integer> it = s_markList.iterator();
        while(it.hasNext()){
            Integer e =it.next();
            String ss = s;
            if(p.length() > s.length()-e){
                ss = s + s;
             
            }
            int f = 0;
          
            for(int i = e; i < e + p.length(); i++){
             
                if(ss.charAt(i) == p.charAt(f)){

                    if(f == p.length()-1){
    
                        judge = "Yes";
                        break;
                    }

                    f++;
                }else{
                    break;
                }
            }
        }
        
        System.out.println(judge);
        
    }
}

