#include <iostream>

using namespace std;

int main(){
    string p, s;
    cin >> p >> s;

    string p2 = p + p;

    if(p2.find(s) != string::npos) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}
