s = list(input())
t = list(input())
ans = 0
for i in range(len(s)):
    if s == t:
        ans = 1
        break
    a = s[0]

    for j in range(len(s)-1):
        s[j] = s[j+1]

    s[-1] = a

if ans == 0:
    print('No')
else:
    print('Yes')