#include <string>
#include <iostream>

using namespace std;

int main(void)
{
    string s, p;
    cin >> s >> p;
    s += s;
    if(s.find(p) == -1) cout << "No\n";
    else cout << "Yes\n";

    return 0;
}
