
#include <iostream>
using namespace std;

int main() {
    string str1, str2;
    cin >> str1 >> str2;
    string str3 = str1;
    bool flag = false;
    int i = str1.size();
    if (str1 == str2)
    {cout << "Yes";flag = true;}
    else while (i) {
        str3 = str3.substr(str1.size() - 1) + str3.substr(0, str1.size() - 1);
        if(str3 == str2)
        {cout << "Yes";flag = true;break;}
        i--;
    }
    if (!flag) cout << "No";
    return 0;
}