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

const int Max = 100;

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

	if(strcmp(s,t) == 0)
		cout << "Yes";
	else for(int j = len_s ; j > 0 ; j--)
	{
		int 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;
}