#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10, N2 = 1e6 + 10, MOD = 1e9 + 7, MAX_CHAR = 26;
char s1[N], s2[N2];
int res = 1, nxt[N][MAX_CHAR];
int main() {
  scanf("%s%s", &s1, &s2);
  int sz1 = strlen(s1), sz2 = strlen(s2);
  memset(nxt, -1, sizeof(nxt));
  for (int i = sz1 - 1; i > -1; i--) {
    int cur = s1[i] - 'a';
    nxt[i][cur] = 0;
    for (int j = 0; j < 26; j++) {
      if (j == cur) continue;
      if (nxt[i + 1][j] == -1) continue;
      nxt[i][j] = 1 + nxt[i + 1][j];
    }
  }
  int p1 = 0, p2 = 0;
  while (p2 != sz2) {
    if (nxt[p1][s2[p2] - 'a'] == -1 && p1 == 0) return printf("-1"), 0;
    if (nxt[p1][s2[p2] - 'a'] == -1)
      res++, p1 = 0;
    else {
      p1 += nxt[p1][s2[p2] - 'a'] + 1;
      p2++;
    }
  }
  return printf("%d", res), 0;
}
