#include <bits/stdc++.h>
using namespace std;
char s1[10005];
char s2[1000005];
int d[10005][30];
bool vis[30];
int main() {
  scanf("%s", s1);
  getchar();
  scanf("%s", s2);
  int len1 = strlen(s1);
  int len2 = strlen(s2);
  memset(vis, 0, sizeof(vis));
  memset(d, -1, sizeof(d));
  int i, j;
  for (i = 0; i < len1; i++) {
    vis[s1[i] - 'a'] = 1;
    for (j = 0; j <= i; j++) {
      if (d[j][s1[i] - 'a'] == -1) d[j][s1[i] - 'a'] = i;
    }
  }
  for (i = 0; i < len2; i++) {
    if (vis[s2[i] - 'a'] == 0) {
      printf("-1\n");
      return 0;
    }
  }
  int ans = 0;
  for (i = 0; i < len2;) {
    j = 0;
    while (i < len2 && j < len1 && d[j][s2[i] - 'a'] != -1) {
      j = d[j][s2[i] - 'a'] + 1;
      i++;
    }
    ans++;
  }
  printf("%d\n", ans);
  return 0;
}
