#include <iostream>
#include <cstring>
#define MAXNUM 110
using namespace std;
char S[MAXNUM];
char T[MAXNUM];
int main()
{
    memset(S,0,sizeof(S));
    memset(T,0,sizeof(T));
    cin>>S>>T;
    bool flag = false;
    int length = strlen(S);
    int i;
    int point_t;
    int j;
    for(i=0;i<length;i++)
    {
        point_t = 0;
        for(j=0;j<length;j++)
        {
            if(T[point_t]!=S[(i+j+length)%length])
                break;
            point_t++;
        }
        if(point_t==length)
        {
            flag = true;
            break;
        }
    }
    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}
