#include<bits/stdc++.h>

using namespace std;

using int64 = long long;

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