#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  string s,t;
  cin >> s >> t;
  s += s;
  auto ret = s.find(t);
  cout << (ret != std::string::npos ? "Yes" : "No") << "\n";
}
