s = input()
t = input()
D = {}
len_s = len(s)
for tc in t:
    D[tc] = [0] * len_s
s += s
flag = True
for a in D.keys():
    index = -1
    for i in range(len_s * 2):
        if s[i] == a:
            index = i
        D[a][i % len_s] = index % len_s
    if index == -1:
        flag = False