#include<iostream>
#include<vector>
#include<string>
typedef long long ll;
typedef long double ld;
using namespace std;
int main() {
	string s, t;
	cin >> s >> t;
	string x = s + s;
	if (x.find(t) == -1)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}