#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int main(){
char s[201],t[101],p[101];
cin >>s >>p;
strcpy(t,s);
strcat(s,t);
if(strstr(s,p)==NULL)cout <<"No" <<endl;
else cout <<"Yes" <<endl;
return 0;
}