#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main(){
string a,b,c;
cin>>a>>b;
c=a+a;
if(c.find(b)!=string::npos){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;}
return 0;
}