#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
	char s1[10000], s2[10000];
	scanf("%s%s", s1, s2);
	strcat(s1, s1);
	strstr(s1, s2) ? printf("Yes\n") : printf("No\n");
	return 0;
}