#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    int len=s.length();
    int out=1;
    while(s!=t){
        if(out==len){cout<<"No"<<endl;return 1;}
        char temp=s[0];
        s.erase(s.begin());
        s=s+temp;
        out++;
    }
    cout<<"Yes"<<endl;
    return 1;
}
