#include<iostream>
#include<cstring>
using namespace std;
int main(){
    string str1,str2;
    cin >> str1 >> str2;
    str1+=str1;
    if(str1.find(str2) == string::npos)cout << "No" << endl;
    else cout << "Yes" << endl;
}
