#include <iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    string S,T;
    cin>>S>>T;
    if(S==T)
        cout<<"Yes";
    else
    {
        string S1;
        for(int i=S.length()-1;i>=0;--i)
        {
            S1.clear();
            S1+=S.substr(i,S.length()-i);
            S1+=S.substr(0,i);
            if(S1==T)
            {
                cout<<"Yes";
                return 0;
            }
        }
        cout<<"No";
    }
    return 0;
}
