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