#include <bits/stdc++.h>
using namespace std;
int f[10030][26];
int main() {
  char s[10030], c;
  int i, j, k, l, a, left, right, mid;
  gets(s);
  l = strlen(s);
  k = 0;
  for (i = 1; i <= l; ++i) {
    for (j = 0; j < 26; ++j) f[i][j] = f[i - 1][j];
    ++f[i][s[i - 1] - 'a'];
  }
  a = 0;
  while (c = getchar(), islower(c)) {
    c -= 'a';
    if (f[l][c] == 0) {
      puts("-1");
      return 0;
    }
    if (f[l][c] - f[k][c] == 0) {
      ++a;
      k = 0;
    }
    left = k;
    right = l;
    while (left + 1 < right) {
      mid = (left + right) >> 1;
      if (f[mid][c] - f[k][c])
        right = mid;
      else
        left = mid;
    }
    k = right;
  }
  printf("%d\n", a + 1);
  return 0;
}
