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

int main() {
	string s1, s2;
	cin >> s1 >> s2;
	s1 = s1+s1;
	for(int i = 0;i < s2.size();i++){
		if(s1.substr(i,s2.size()) == s2){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}