#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define ios std::ios::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define PI acos(-1.0)
#define EPS 1e-9 //epsilon 10^-9, checking for equality 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define go(i,a,n) for(int i=a;i<n;i++)
#define og(i,a,n) for(int i=n-1;i>=a;i--)
#define goll(i,a,n) for(ll i=a;i<n;i++)
#define ogll(i,a,n) for(ll i=n-1;i>=0;i--)
#define rep(i,n) go(i,0,n)
#define per(i,n) og(i,0,n)
#define repll(i,n) goll(i,0,n)
#define perll(i,n) ogll(i,0,n)
#define sz(x) (x.size())
#define isort(x) sort(x.begin(),x.end())
#define dsort(x) sort(x.rbegin(),x.rend())
#define all(x) x.begin(),x.end()
#define rall(x) (x).rbegin(),(x).rend()
#define pr(x) cout<<(x)<<endl
//Element e in structure s
#define exist(e,s) ((s).find(e)!=(s).end())
//Character in structure
#define existstr(c,s) ((s).find(c) !=string::npos)
//x in structure
#define fo(x,s) for(auto &x:s)
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vector<int> > vvi;
typedef vector< vector<ll> > vvll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector< pair<int,int> > vpii;
typedef set<int> si;
typedef set<char> sc;
typedef set<ll> sll;
typedef map<int,int> mii;
typedef multimap<int,int> mmii;
const int inf=1e9+7; //10^9 +7
void solve();

//Many functions are taken from geeksforgeeks and other websites

//sorting pair<int,int> on second
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
{
	   return (a.second < b.second);
}
bool sortbysecdesc(const pair<int,int> &a, const pair<int,int> &b)
{
       return a.second>b.second;
}

// (x^y)%p in O(log y)
ll modpower(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p; 
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = ( (x%p)* (x%p) ) % p;  
    }
    return res%p;
}

//works for negative too
long double power(long double x, ll y)
{
    long double temp;
    if( y == 0)
       return 1;
    temp = power(x, y/2);       
    if (y%2 == 0)
        return temp*temp;
    else
    {
        if(y > 0)
            return x*temp*temp;
        else
            return (temp*temp)/x;
    }
}

//O(1) , true if power of two
bool ispowtwo(int x)
{
    return x && (!(x&(x-1))); 
}

// true if n can be written as x^y, x>0 && y>1
bool ispown(ll n)
{
    if (n <= 1) return true;
    for (ll x=2; x<=sqrt(n); x++)
    {
        ll  p = x;
        while (p <= n)
        {
            p *= x;
            if (p == n)
                return true;
        }
    }
    return false;
}

// true if y=x^k; y can be written as power of x
bool ispower(int x, int y)
{
    ll res1 = log(y) / log(x);
    long double res2 = log(y) / log(x);
    return (res1 == res2);
}


//O(log min(a,b))
ll gcd(ll a, ll b)
{ 
    if (a == 0 || b == 0)
       return 0; 
    if (a == b)
        return a;
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

// xa+yb=gcd(a,b) ,finds gcd(a,b) and updates x and y
ll gcdextended(ll a, ll b, ll &x, ll &y)
{
    if (a == 0)
    {
        x = 0;
        y = 1;
        return b;
    }
    ll x1,y1;
    ll gcdresult = gcdextended(b%a, a, x1, y1);
    x = y1 - (b/a) * x1;
    y = x1;
    return gcdresult;
}

ll gcdarr(vi arr)
{
    ll result = arr[0];
    ll n=arr.size();
    for (ll i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

//O(log m) , when a and m are coprime i.e. (gcd(a,m)==1)
ll modinverse(ll a, ll m)
{
    if(gcd(a,m)!=1) return -1; // modulo inverse does not exist
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

ll lcm(ll a, ll b)
{
    return (a*b)/gcd(a, b);
}

//O(sqrt(n) )
bool isprime(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
}

//O(sqrt(n) 
bool isperfect(ll n)
{
    ll sum = 1;
    for (ll i=2; i*i<=n; i++)
        if (n%i==0)
            sum = sum + i + n/i;
     if (sum == n && n != 1)
          return true; 
     return false;
}

ll digitsum(ll x)
{
    ll dig;
    ll sum = 0;
    while (x) 
    {
        dig = x % 10;
        sum = sum + dig;
        x = x / 10;
    }
    return sum;
}

ll reversedigits(ll num)
{
    ll rev_num = 0;
    while(num > 0)
    {
        rev_num = rev_num*10 + num%10;
        num = num/10;
    }
    return rev_num;
}

//return maximum value and its index;
ll maxinivec(vi& v,int& index)
{
    ll max=LLONG_MIN;
    for(ll i=0;i<v.size();i++)
    {
        if(v[i]>max){ max=v[i]; index=i;}
    }
    return max;
}

//return maximum value and its index;
ll mininivec(vi& v,int& index)
{
    ll min=LLONG_MAX;
    for(ll i=0;i<v.size();i++)
    {
        if(v[i]<min){ min=v[i]; index=i;}
    }
    return min;
}

//return maximum value and its index;
ll maxinllvec(vll& v,int& index)
{
    ll max=LLONG_MIN;
    for(ll i=0;i<v.size();i++)
    {
        if(v[i]>max){ max=v[i]; index=i;}
    }
    return max;
}

//return maximum value and its index;
ll mininllvec(vll& v,int& index)
{
    ll min=LLONG_MAX;
    for(ll i=0;i<v.size();i++)
    {
        if(v[i]<min){ min=v[i]; index=i;}
    }
    return min;
}

//read vector int
void rvi(vi& v, int n)
{
    int temp;
    go(i,0,n)
    {
        cin>>temp;
        v.pb(temp);    
    }   
}
//read vector long long
void rvll(vll& v, int n)
{
    ll temp;
    go(i,0,n)
    {
        cin>>temp;
        v.pb(temp);    
    }   
}

//print vec int
void prvi(vi&a)
{
    go(i,0,a.size())
    {
        cout<<a[i]<<" ";
    }
    cout<<endl;
}
void prvll(vll&a)
{
    go(i,0,a.size())
    {
        cout<<a[i]<<" ";
    }
    cout<<endl;
}

vi iprefixsum(vi& a)
{
    vi b;
    b.pb(a[0]);
    go(i,1,a.size())
    {
        b.pb(a[i]+b[i-1]);
    }
    return b;
}
vi isuffixsum(vi& a)
{
    vi b(sz(a));
    b[sz(a)-1]=a[sz(a)-1];
    og(i,0,sz(a)-1)
    {
        b[i]=a[i]+b[i+1];
    }
    return b;
}
vll llprefixsum(vll& a)
{
    vll b;
    b.pb(a[0]);
    go(i,1,a.size())
    {
        b.pb(a[i]+b[i-1]);
    }
    return b;
}
vll llsuffixsum(vll& a)
{
    vll b(sz(a));
    b[sz(a)-1]=a[sz(a)-1];
    og(i,0,sz(a)-1)
    {
        b[i]=a[i]+b[i+1];
    }
    return b;
}
/*====================================================================
            STRINGS
======================================================================*/
string upperwhole(string s)
{
    for(ll i=0;i<s.size();i++)
    {
        s[i]=toupper(s[i]);
    }
    return s;
}

string lowerwhole(string s)
{
    for(ll i=0;i<s.size();i++)
    {
        s[i]=tolower(s[i]);
    }
    return s;
}

string changecasewhole(string s)
{
    for(ll i=0;i<s.size();i++)
    {
        if(isupper(s[i])) s[i]=tolower(s[i]);
        else
            s[i]=toupper(s[i]);
    }
    return s;
}
/*================================================================
        SEARCHING
==================================================================*/
//returns index, a should be in ascending order
int bsearch(vi& a,int l,int r,int val)
{
    int mid;
    while(l<=r)
    {
        mid=(l+r)/2;
        if(a[mid]==val) return mid;
        else if(a[mid]<val) l=mid+1;
        else r=mid-1;
    }
    return -1; //if not found
}

/*=================================================================
            DEBUGGING TOOLS
===================================================================*/
//print map<int,int>
void prmii(mii& m)
{
    for(auto x:m)
    {
        cout<<x.fi<<" "<<x.se<<endl;
    }
    cout<<endl;
}

/*=================================================================
            MAIN FUNCTION
===================================================================*/
//global variables


int main()
{
    ios;
    solve();
    return 0;
}
/*=================================================================
            SOLVE FUNCTION
===================================================================*/
void solve()
{
    string s,t;
    cin>>s>>t;
    if(s.size()!=t.size())
    {
        cout<<"No"<<endl;
    }
    for(int i=1;i<=s.size();i++)
    {
        char c=s[s.size()-1];
       // cout<<c<<endl;
        s.insert(0,1,s[s.size()-1]);
        s.erase(s.size()-1);
        if(s==t)
        {
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256