#include <bits/stdc++.h>
int pos[26], next[10002][26];
char a[10002], b[1000002];
int main() {
  int n, m, ans;
  int i, j, k;
  scanf("%s%s", a + 1, b + 1);
  n = strlen(a + 1);
  m = strlen(b + 1);
  for (i = 1; i <= n; ++i) a[i] -= 'a';
  for (i = 1; i <= m; ++i) b[i] -= 'a';
  for (i = n; i; --i) pos[a[i]] = i;
  for (i = n; i >= 0; --i) {
    for (j = 0; j < 26; ++j) next[i][j] = pos[j];
    pos[a[i]] = i;
  }
  j = 0;
  k = 1;
  ans = -1;
  for (i = 1; i <= m; ++i) {
    if (next[j][b[i]] == 0) break;
    if (j >= next[j][b[i]]) ++k;
    j = next[j][b[i]];
  }
  if (i > m) ans = k;
E:
  printf("%d", ans);
  return 0;
}
