#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
char s1[N << 1], s2[N];
int main()
{
    while (~scanf("%s%s", s1, s2))
    {
        auto l1 = strlen(s1), l2 = strlen(s2);
        if (l2 > l1)
            puts("no");
        else
        {
            memcpy(s1 + l1, s1, l1), s1[l1 << 1] = 0;
            puts(strstr(s1, s2) ? "yes" : "no");
        }
    }
    return 0;
}
