#include <bits/stdc++.h>
using namespace std;
char s1[10010], s2[1000020];
int f[10010][29];
int main() {
  int i, j, n1, n2;
  while (scanf("%s%s", s1, s2) != EOF) {
    n1 = strlen(s1);
    n2 = strlen(s2);
    int cnt = 0;
    memset(f, -1, sizeof(f));
    n1--;
    f[n1][s1[n1] - 'a'] = n1;
    for (i = n1 - 1; i >= 0; --i) {
      for (j = 0; j < 26; j++) f[i][j] = f[i + 1][j];
      f[i][s1[i] - 'a'] = i;
    }
    i = 0;
    int pos = 0;
    bool exist = 1;
    int tmp;
    while (1) {
      int num = s2[i] - 'a';
      tmp = f[pos][num];
      if (tmp == -1) {
        if (pos == 0) {
          exist = 0;
          break;
        } else {
          cnt++;
          pos = 0;
          continue;
        }
      }
      pos = tmp + 1;
      i++;
      if (i >= n2) {
        cnt++;
        break;
      }
    }
    if (exist == 0) {
      puts("-1");
      continue;
    }
    printf("%d\n", cnt);
  }
}
