#include <bits/stdc++.h>
int tab[10015][30];
char a[10015];
char b[1000015];
int la, lb;
int main() {
  int chr[30];
  int i, j;
  int step;
  scanf("%s %s", a, b);
  la = strlen(a);
  lb = strlen(b);
  for (i = 0; i < 26; i++) chr[i] = tab[la][i] = la;
  for (i = la - 1; i >= 0; i--) {
    chr[a[i] - 97] = i;
    for (j = 0; j < 26; j++) tab[i][j] = chr[j];
  }
  for (i = 0, j = 0, step = 1; i < lb; i++, j++) {
    j = tab[j][b[i] - 97];
    if (j == la) {
      j = tab[0][b[i] - 97];
      step++;
      if (j == la) {
        printf("-1\n");
        return 0;
      }
    }
  }
  printf("%d\n", step);
  return 0;
}
