#include <bits/stdc++.h>
using namespace std;

int	main()
{
	string	s, p;
	cin >> s >> p;
	string	twice_s(s + s);
	if (twice_s.find(p) == string::npos)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}
