#include <bits/stdc++.h>
using namespace std;

int main()
{
    string a, b;
    cin>>a>>b;
    a = a+a;
    
    if(a.find(b) != string::npos && (a.length()/2 == b.length())) puts("Yes");
    else puts("No");
    return 0;
}
