#include <string>
#include <iostream>
using namespace std;
string s, t;
int main() {
	cin >> s >> t;
	bool f = false;
	for (int i = 0; i < s.size(); ++i) {
		if (s.substr(i) + s.substr(0, i) == t) f = true;
	}
	cout << (f ? "Yes\n" : "No\n");
	return 0;
}