#include<iostream>
#include<string>
using namespace std;
int main()
{
	string str,ing;
	cin>>str;
	cin>>ing;
	str+=str;
	int q=(int)str.find(ing);
	if(q==-1)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}
