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

int main() {
	string s;
	getline(cin, s);
	string t;
	getline(cin, t);
	s += s;
	if (s.find(t) != -1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;		
}

