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

int main(){
  
  string str;
  string str1;

  cin>>str>>str1;

  str+=str;

  if(str.find(str1)!=-1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
  return 0;

}
		  
