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

int main() {
	
	string s, p;
	cin >> s >> p;
	
	s += s;
	if (s.find(p) <= s.size()) {
		cout << "Yes\n";
	} else cout << "No\n";
	
		
	return 0;
}
