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

const int Max = 101;
char s[Max],t[Max];
int main()
{
	cin >> s >> t;
	int len_s = strlen(s);

	if(strcmp(s,t) == 0)
		cout << "Yes";
	else 
	{
		for(int j = len_s ; j > 0 ; j--)
		{
			char temp;
			temp = s[len_s - 1];
			for(int i = len_s - 1 ; i > 0 ; i--)
			{
				s[i] = s[i - 1];
			}
			s[0] = temp;

			if(strcmp(s,t) == 0)
			{
				cout << "Yes";
				break;
			}
			else
			{
				if(j == 1)
					cout << "No";

			}
		}
	}
    return 0;
}