s = input()
t = input()
alphabet_num = 26
double_s = s+s
len_s = len(s)
next_step = []
for i in range(len_s):
    next_step_same_alphabet = [-1]*alphabet_num
    for alphabet in range(alphabet_num):
        for j in range(i+1,len_s*2):
            if alphabet == ord(double_s[j])-ord('a'):
                next_step_same_alphabet[alphabet] = j-i
                break
            else:
                continue
    next_step.append(next_step_same_alphabet)
count = 0
place_now = 0
if t[0] != s[0]:
    count += 1
for i in range(len(t)):
    if next_step[place_now][ord(t[i])-ord('a')]  > 0:
        count += next_step[place_now][ord(t[i])-ord('a')]
        place_now += next_step[place_now][ord(t[i])-ord('a')]
        if place_now >= len_s:
            place_now = place_now - len_s
    else:
        count = -1
        break
print(count)
