#include <bits/stdc++.h>
using namespace std;
char s1[11000];
char s2[1100000];
int dp[11000][30];
int main() {
  scanf("%s\n", s1);
  scanf("%s", s2);
  int len1 = strlen(s1);
  int len2 = strlen(s2);
  for (int(i) = 0; (i) < (11000); ++(i))
    for (int(j) = 0; (j) < (30); ++(j)) dp[i][j] = -1;
  for (int(i) = 0; (i) < (len1); ++(i)) {
    int kod = s1[i] - 'a';
    if (dp[len1 - 1][kod] == -1) dp[len1 - 1][kod] = i + 1;
  }
  for (int i = len1 - 2; i >= 0; --i) {
    for (int(j) = 0; (j) < (30); ++(j))
      if (dp[i + 1][j] != -1) dp[i][j] = dp[i + 1][j] + 1;
    int kod = s1[i + 1] - 'a';
    dp[i][kod] = 1;
  }
  long long ret = 0LL;
  int pos = len1 - 1;
  for (int(i) = 0; (i) < (len2); ++(i)) {
    int kod = s2[i] - 'a';
    if (dp[pos][kod] == -1) {
      cout << -1 << endl;
      return 0;
    }
    pos += dp[pos][kod];
    while (pos >= len1) {
      pos -= len1;
      ++ret;
    }
  }
  cout << ret << endl;
  return 0;
}
