#include <bits/stdc++.h>
using namespace std;
int table[10009][26];
char buf[1000009];
int main() {
  scanf("%s", buf);
  memset(table, -1, sizeof(table));
  for (int i = strlen(buf) - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) table[i][j] = table[i + 1][j];
    table[i][buf[i] - 'a'] = i;
  }
  scanf("%s", buf);
  int ans = 1;
  for (int i = 0, j = 0; ans > 0 && buf[i]; i++) {
    int c = buf[i] - 'a';
    while (table[j][c] == -1)
      if (j == 0) {
        ans = -1;
        break;
      } else {
        j = 0;
        ans++;
      }
    j = table[j][c] + 1;
  }
  printf("%d\n", ans);
  return 0;
}
