#include<iostream>
#include<string>
using namespace std;

int main()
{
	string s,t;
	char c;
	cin>>s>>t;
	if (s==t) {
		cout<<"Yes";
		return 0;
	}
	int l=s.length();
	for (int i=0;i<l;i++){
		c=s[s.length()-1];
		s=s.substr(0,s.length()-1);
		s=c+s;
		if (s==t) {
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	
	return 0;
} 