#include<bits/stdc++.h>
#define MOD 1000000007
#define F first
#define S second

typedef long long ll;
using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    s += s;
    cout << (s.find(t) != std::string::npos ? "Yes" : "No");
    return 0;
}
