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

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