/* ITP1_8_D */
import java.io.*;

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;

      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  }
} import java.io.*; io.* java class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;

      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  }
} Main public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;

      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  } main {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;

      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  } try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;

      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    } catch(Exception e){
      System.out.println(e);
    } Exception e {
      System.out.println(e);
    } System.out.println(e) System.out.println System.out System System.out e {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;

      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br if(s.length() < p.length()) return; s.length() < p.length() s.length() s.length s p.length() p.length p return; boolean judge = false; judge false char[] s_char = s.toCharArray(); s_char s.toCharArray() s.toCharArray s for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      } {
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      } if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        } s_char[i] == p.charAt(0) s_char[i] s_char i p.charAt(0) p.charAt p 0 {

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        } for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          } int j = 0; int j = 0; j 0 j < p.length() j p.length() p.length p j++ j++ j {
            sb.append( s_char[(i+j) % s.length()] );
          } {
            sb.append( s_char[(i+j) % s.length()] );
          } sb.append( s_char[(i+j) % s.length()] ) sb.append sb s_char[(i+j) % s.length()] s_char (i+j) % s.length() (i+j) i j s.length() s.length s if(p.equals(sb.toString())) judge = true; p.equals(sb.toString()) p.equals p sb.toString() sb.toString sb judge = true judge true sb.delete(0, sb.length()) sb.delete sb 0 sb.length() sb.length sb if(judge)
        System.out.println("Yes");
      else
        System.out.println("No"); judge 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
/* ITP1_8_D */
import java.io.*;

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;

      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){

          for(int j = 0; j < p.length(); j++){
            sb.append( s_char[(i+j) % s.length()] );
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  }
}