#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3fLL;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int maxn = 1e6 + 10;
char s1[maxn], s2[maxn];
int a[maxn][30];
bool vis[maxn];
int main() {
  cin >> s1 >> s2;
  int l1 = strlen(s1), l2 = strlen(s2);
  memset(a, -1, sizeof(a));
  for (int i = 0; i < l1; i++) {
    vis[s1[i] - 'a'] = 1;
    for (int j = 0; j <= i; j++)
      if (a[j][s1[i] - 'a'] == -1) a[j][s1[i] - 'a'] = i;
  }
  for (int i = 0; i < l2; i++) {
    if (!vis[s2[i] - 'a']) return puts("-1"), 0;
  }
  int j = 0, ans = 0;
  while (j < l2) {
    ans++;
    int i = 0;
    while (j < l2 && a[i][s2[j] - 'a'] != -1) {
      i = a[i][s2[j] - 'a'] + 1;
      j++;
    }
  }
  cout << ans << endl;
  return 0;
}
