#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
const int INF = 999999999;
int main() {
  string S, T;
  cin >> S >> T;
  for (int i = 0; i < (S.size()); i++) {
    S = S[S.size() - 1] + S.substr(0, S.size() - 1);
    if (S == T) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
