#include<bits/stdc++.h>
using namespace std;

int main(){
  string s,t;
  cin >> s >> t;
  
  s = s+s;
  
  int flag = 0;
  if(s.find(t) < s.size())
    flag = 1;
  
  
  if(flag==1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}