#include <iostream>

using namespace std;

int main() {
    string S, T;
    cin >> S >> T;
    S += S;
    if(S.find(T)!=string::npos) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return 0;
    
}