#include <bits/stdc++.h>
#include <string>
#define MAXN 1000
using namespace std;
string S, T;
string mov(string str, int N)
{
    string strr = str;
    int i = 0, j;
    while(i < N)
    {
        char c = strr[strr.length() - 1];
        for(j = strr.length() - 1; j >  0; j--)
        {
            strr[j] = strr[j - 1];
        }
        strr[0] = c;
        i++;
    }
    return strr;
}
int main()
{
    cin>>S;
    cin>>T;
    for(int i = 0; i < S.length(); i++ )
    {
        if(mov(S, i) == T)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}
