local mfl = math.floor

local function comp(a, b)
  return a < b
end

local function lower_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if not comp(ary[1], x) then return 1 end
  if comp(ary[num], x) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if comp(ary[mid], x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local function upper_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if comp(x, ary[1]) then return 1 end
  if not comp(x, ary[num]) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if not comp(x, ary[mid]) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local s = io.read()
local t = io.read()
local w = {}
for i = 1, 26 do
  w[i] = {}
end
for i = 1, #s do
  local b = s:byte(i) - 96
  table.insert(w[b], i)
end
for i = 1, #t do
  local b = t:byte(i) - 96
  if #w[b] == 0 then print(-1) os.exit() end
end
local loop = 0
local pos = 0
for i = 1, #t do
  local b = t:byte(i) - 96
  local ub = upper_bound(w[b], pos)
  if #w[b] < ub then
    loop = loop + 1
    pos = w[b][1]
  else
    pos = w[b][ub]
  end
end
print(loop * #s + pos)
