import java.io.*;
import java.util.*;

public class Main
{
    public static void main(String[] argv)
    {
        try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        }
    }
}

class Solver
{
    String patten,target;
    boolean winFlag;
    public Solver(String s1,String s2)
    {
        patten=s1;
        target=s2;
        winFlag=false;
    }
    public void solve()
    {
        String tmp = target+target;
        for( int i=0;i<patten.length();i++)
        {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        }

    } 
    public void approach()
    {
        if(winFlag==true)
            System.out.println("Yes");
        else
            System.out.println("No");
            
    }
    
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz