#include <iostream>
#include <string>

using namespace std;

int main(){
  string s, t, tmp;
  cin >> s >> t;

  tmp=s+s;
  if (tmp.find(t)!=string::npos) 
      cout << "Yes" << endl;
  else
      cout << "No" << endl;
  return 0;
}