import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String p = sc.next();
    String ans = "No";

    for(int i = 0; i < s.length(); i++){
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    }

    System.out.println(ans);
  }
}
 import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String p = sc.next();
    String ans = "No";

    for(int i = 0; i < s.length(); i++){
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    }

    System.out.println(ans);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String p = sc.next();
    String ans = "No";

    for(int i = 0; i < s.length(); i++){
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    }

    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String p = sc.next();
    String ans = "No";

    for(int i = 0; i < s.length(); i++){
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    }

    System.out.println(ans);
  } 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 String ans = "No"; ans "No" for(int i = 0; i < s.length(); i++){
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    } {
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    } if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      } i + p.length() > s.length() i + p.length() i p.length() p.length p s.length() s.length s {
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        } p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length())) p.equals p s.substring(i) + s.substring(0, i + p.length() - s.length()) s.substring(i) s.substring s i s.substring(0, i + p.length() - s.length()) s.substring s 0 i + p.length() - s.length() i + p.length() i p.length() p.length p s.length() s.length s {
          ans = "Yes";
        } ans = "Yes" ans "Yes" {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      } if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        } 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 {
          ans = "Yes";
        } ans = "Yes" ans "Yes" System.out.println(ans) System.out.println System.out System System.out ans 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();
    String ans = "No";

    for(int i = 0; i < s.length(); i++){
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    }

    System.out.println(ans);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String p = sc.next();
    String ans = "No";

    for(int i = 0; i < s.length(); i++){
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    }

    System.out.println(ans);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String p = sc.next();
    String ans = "No";

    for(int i = 0; i < s.length(); i++){
      if(i + p.length() > s.length()){
        if(p.equals(s.substring(i) + s.substring(0, i + p.length() - s.length()))){
          ans = "Yes";
        }
      } else {
        if(p.equals(s.substring(i, i + p.length()))){
          ans = "Yes";
        }
      }
    }

    System.out.println(ans);
  }
}

