#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s, p;
  cin >> s >> p;
  s += s;
  puts(s.find(p) == string::npos ? "No" : "Yes");
}


