using System;
using System.Collections.Generic;
using System.Linq;


public class Contest
{
	public static void Main()
	{

/*
		int n = a[0];
		int[][] e;
		MyIO.ReadMatrix(n, out e);

		int[] a;
		MyIO.ReadArray(out a);

        long a,b,c,d,e,f;
        MyIO.ReadMulti(out a, out b, out c, out d, out e, out f);

		MyIO.WriteArray(ans);
*/

        string s,t;
		MyIO.ReadMulti(out s);
		MyIO.ReadMulti(out t);

		int idx = 0;
		int[][] ord = new int[t.Length][];
		SortedList<char,int[]> dic = new SortedList<char, int[]>();
		foreach(char c in t){
			if(dic.ContainsKey(c)){
				ord[idx] = dic[c];
			}else{
				List<int> cil = new List<int>();
				int ci = s.IndexOf(c);

				if(ci<0){
					Console.WriteLine("-1");
					return;
				}else{
					while(0<=ci){
						cil.Add(ci);
						ci = s.IndexOf(c, ci + 1);
					}
				}
				ord[idx] = cil.ToArray();
				dic[c] = ord[idx];
			}

			idx++;
		}


		int li = 0;
		int lj = -1;
		foreach(int[] oi in ord){
			int st = Array.BinarySearch(oi, lj+1);
			if(-st-1==oi.Length){
				li++;
				lj = oi[0];

			}else{
				if(0<=st){
					lj = oi[st];
				}else{
					lj = oi[-st-1];	
				}
			}
		}

		ulong sum = (ulong)s.Length*(ulong)li+(ulong)lj+1;
		Console.WriteLine(sum);
		
	}


}

public static class MyIO
{
	private static bool eq<T, U>() => typeof(T).Equals(typeof(U));
	private static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
	private static T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
	                                  : eq<T, long>()   ? ct<T, long>(long.Parse(s))
	                                  : eq<T, double>() ? ct<T, double>(double.Parse(s))
	                                  : eq<T, char>()   ? ct<T, char>(s[0])
	                                                    : ct<T, string>(s);
	public static string[] ReadArray<T>(out T[] a) {		
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 												
		a = System.Array.ConvertAll(ar, new Converter<string,T>(cv<T>));
		return ar;
	}										
	public static string[] ReadMulti<T>(out T a) {
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 
		a = cv<T>(ar[0]);
		return ar;
	}
	public static string[] ReadMulti<T, U>(out T a, out U b) {
		var ar = ReadMulti<T>(out a); 
        b = cv<U>(ar[1]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V>(out T a, out U b, out V c) {
		var ar = ReadMulti<T, U>(out a, out b); 
        c = cv<V>(ar[2]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W>(out T a, out U b, out V c, out W d) {
		var ar = ReadMulti<T, U, V>(out a, out b, out c); 
        d = cv<W>(ar[3]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) {
		var ar = ReadMulti<T, U, V, W>(out a, out b, out c, out d); 
        e = cv<X>(ar[4]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) {
		var ar = ReadMulti<T, U, V, W, X>(out a, out b, out c, out d, out e); 
        f = cv<Y>(ar[5]);
		return ar;
	}
	public static string[][] ReadMatrix<T>(int n, out T[][] a) {
		a = new T[n][];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) arr[i] = ReadArray(out a[i]);
		return arr;
	}
	public static string[][] ReadLines<T>(int n, out T[] a) {
		a = new T[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) arr[i] = ReadMulti(out a[i]);
		return arr;
	}
	public static string[][] ReadLines<T, U>(int n, out T[] a, out U[] b) {
		a = new T[n];	b = new U[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) arr[i] = ReadMulti(out a[i], out b[i]);
		return arr;
	}
	public static string[][] ReadLines<T, U, V>(int n, out T[] a, out U[] b, out V[] c) {
		a = new T[n];	b = new U[n];	c = new V[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) arr[i] = ReadMulti(out a[i], out b[i], out c[i]);
		return arr;
	}

	public static void WriteArray<T>(T[] a) {
		Console.WriteLine(string.Join(" ", Array.ConvertAll(a, x => x.ToString())));
	}


}




Measured memory_bytes: 17376