import java.util.Scanner;
  
class Main{
  public static void main(String[] arg){
    
    Scanner in = new Scanner(System.in);

    String s = in.nextLine();
    String p = in.nextLine();

    String tmp = s + s.substring(0, p.length());

    if(tmp.indexOf(p) != -1)
        System.out.println("Yes");
    else
        System.out.println("No");

  }
} import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] arg){
    
    Scanner in = new Scanner(System.in);

    String s = in.nextLine();
    String p = in.nextLine();

    String tmp = s + s.substring(0, p.length());

    if(tmp.indexOf(p) != -1)
        System.out.println("Yes");
    else
        System.out.println("No");

  }
} Main public static void main(String[] arg){
    
    Scanner in = new Scanner(System.in);

    String s = in.nextLine();
    String p = in.nextLine();

    String tmp = s + s.substring(0, p.length());

    if(tmp.indexOf(p) != -1)
        System.out.println("Yes");
    else
        System.out.println("No");

  } main {
    
    Scanner in = new Scanner(System.in);

    String s = in.nextLine();
    String p = in.nextLine();

    String tmp = s + s.substring(0, p.length());

    if(tmp.indexOf(p) != -1)
        System.out.println("Yes");
    else
        System.out.println("No");

  } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.nextLine(); s in.nextLine() in.nextLine in String p = in.nextLine(); p in.nextLine() in.nextLine in String tmp = s + s.substring(0, p.length()); tmp s + s.substring(0, p.length()) s s.substring(0, p.length()) s.substring s 0 p.length() p.length p if(tmp.indexOf(p) != -1)
        System.out.println("Yes");
    else
        System.out.println("No"); tmp.indexOf(p) != -1 tmp.indexOf(p) tmp.indexOf tmp p -1 1 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[] arg arg
import java.util.Scanner;
  
class Main{
  public static void main(String[] arg){
    
    Scanner in = new Scanner(System.in);

    String s = in.nextLine();
    String p = in.nextLine();

    String tmp = s + s.substring(0, p.length());

    if(tmp.indexOf(p) != -1)
        System.out.println("Yes");
    else
        System.out.println("No");

  }
}