#include<iostream>
#include<string>

int main(){
    using namespace std;
    string s,p;

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

    return 0;

}
