#include<iostream>
using namespace std;

int main(){

string s, p;
string str;
cin>>s>>p;

str=s+s;
if(str.find(p) != string::npos){
    cout<<"Yes"<<endl;
}else{
    cout<<"No"<<endl;
}

    return 0;
}
