if __name__ == '__main__':

    s_txt = eval(input())

    p_txt = eval(input())



    base_txt = s_txt * 2

    base_txt = base_txt[:-1]  # s_txt=='hoge', p_txt=='hogehoge' ??????????????´???????????£??????????????????????????????????????????????????????



    if p_txt in base_txt:

        print('Yes')

    else:

        print('No')
# -*- coding: utf-8 -*-

"""

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D&lang=jp



"""

import sys

from sys import stdin

input = stdin.readline





def main(args):

    s = input().strip()

    p = input().strip()



    s = s + s[:-1]

    if p in s:

        print('Yes')

    else:

        print('No')





if __name__ == '__main__':

    main(sys.argv[1:])

    
if __name__ == "__main__":
    s_txt = eval(input())
    p_txt = eval(input())
    base_txt = s_txt * 2
    base_txt = base_txt[
        :-1
    ]  # s_txt=='hoge', p_txt=='hogehoge' ??????????????´???????????£??????????????????????????????????????????????????????
    if p_txt in base_txt:
        print("Yes")
    else:
        print("No")

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D&lang=jp
"""
import sys
from sys import stdin

input = stdin.readline


def main(args):
    s = input().strip()
    p = input().strip()
    s = s + s[:-1]
    if p in s:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main(sys.argv[1:])

-if __name__ == "__main__": -    s_txt = eval(input()) -    p_txt = eval(input()) -    base_txt = s_txt * 2 -    base_txt = base_txt[ -        :-1 -    ]  # s_txt=='hoge', p_txt=='hogehoge' ??????????????´???????????£?????????????????????????????????????????????????????? -    if p_txt in base_txt: +# -*- coding: utf-8 -*- +""" +http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D&lang=jp +""" +import sys +from sys import stdin + +input = stdin.readline + + +def main(args): +    s = input().strip() +    p = input().strip() +    s = s + s[:-1] +    if p in s: + + +if __name__ == "__main__": +    main(sys.argv[1:])