import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    int si;
    for(si = 0;si < s.length();si++){
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    }
    if(si == s.length())System.out.println("No");
    sc.close();
  }
}
 import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    int si;
    for(si = 0;si < s.length();si++){
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    }
    if(si == s.length())System.out.println("No");
    sc.close();
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    int si;
    for(si = 0;si < s.length();si++){
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    }
    if(si == s.length())System.out.println("No");
    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    int si;
    for(si = 0;si < s.length();si++){
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    }
    if(si == s.length())System.out.println("No");
    sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc int si; si for(si = 0;si < s.length();si++){
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    } si = 0; si = 0 si 0 si < s.length() si s.length() s.length s si++ si++ si {
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    } {
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    } if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      } s.charAt(si) == p.charAt(0) s.charAt(si) s.charAt s si p.charAt(0) p.charAt p 0 {
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      } int pi; pi for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        } pi = 1; pi = 1 pi 1 pi < p.length() pi p.length() p.length p pi++ pi++ pi {
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        } {
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        } if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break; s.charAt((si + pi) % s.length()) != p.charAt(pi) s.charAt((si + pi) % s.length()) s.charAt s (si + pi) % s.length() (si + pi) si pi s.length() s.length s p.charAt(pi) p.charAt p pi break; if(pi == p.length()){
          System.out.println("Yes");
          break;
        } pi == p.length() pi p.length() p.length p {
          System.out.println("Yes");
          break;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" break; if(si == s.length())System.out.println("No"); si == s.length() si s.length() s.length s System.out.println("No") System.out.println System.out System System.out "No" sc.close() sc.close sc String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    int si;
    for(si = 0;si < s.length();si++){
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    }
    if(si == s.length())System.out.println("No");
    sc.close();
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    int si;
    for(si = 0;si < s.length();si++){
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    }
    if(si == s.length())System.out.println("No");
    sc.close();
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    int si;
    for(si = 0;si < s.length();si++){
      if(s.charAt(si) == p.charAt(0)){
        int pi;
        for(pi = 1;pi < p.length();pi++){
          if(s.charAt((si + pi) % s.length()) != p.charAt(pi))break;
        }
        if(pi == p.length()){
          System.out.println("Yes");
          break;
        }
      }
    }
    if(si == s.length())System.out.println("No");
    sc.close();
  }
}

