#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


int main()
{
	string s1,s2;
	cin >> s1 >> s2;
	int n = s1.size();

	for(int i = 0 ; i < n ; i++)
	{
		if(s1 == s2)
		{
			cout << "Yes";
			return 0;
		}
		string s3 = s1.substr(0,n - 1);
		s1 = s1[n - 1] + s3;

	}
	cout << "No";

    return 0;
}