#include <bits/stdc++.h>
int main() {
  char s1[10010], s2[1000010];
  int a[26][10000], b[26] = {};
  scanf("%s\n%s", &s1, &s2);
  int k1 = strlen(s1);
  int k2 = strlen(s2);
  for (int i = 0; i < k1; i++) {
    a[s1[i] - 'a'][b[s1[i] - 'a']] = i;
    b[s1[i] - 'a']++;
  }
  int t = 0, t1 = 0, kol = 0;
  for (int i = 0; i < k2; i++) {
    int e = s2[i] - 'a';
    int y = b[s2[i] - 'a'];
    if (y == 0) {
      printf("-1");
      return 0;
    }
    int l = 0, r = y - 1;
    while (1) {
      if (r <= l + 1) {
        if (a[e][l] >= t)
          t = a[e][l] + 1;
        else if (a[e][r] >= t)
          t = a[e][r] + 1;
        else {
          kol++;
          t = 0;
          l = 0;
          continue;
        }
        break;
      }
      t1 = (l + r) / 2;
      if (t1 == 0) {
        t = a[e][t1] + 1;
        break;
      }
      if (a[e][t1] > t) {
        r = t1;
      } else
        l = t1;
    }
    if (t >= k1) {
      kol++;
      t = 0;
    }
  }
  if (t > 0) kol++;
  printf("%d", kol);
  return 0;
}
