#include <bits/stdc++.h>
using namespace std;
char g_s1[10009];
char g_s2[1000009];
int g_st[26][10009];
int main() {
  while (~scanf("%s %s", g_s1, g_s2)) {
    int i = 0, j = 0;
    int len_s1 = 0;
    int find = 0;
    int need = 0;
    memset(g_st, -1, sizeof(g_st));
    len_s1 = strlen(g_s1);
    for (j = 0; j < len_s1; j++) {
      for (i = 0; i <= j; i++) {
        if (g_st[g_s1[j] - 'a'][i] == -1) {
          g_st[g_s1[j] - 'a'][i] = j;
        }
      }
    }
    i = 0;
    while (g_s2[i]) {
      if (g_st[g_s2[i] - 'a'][0] == -1) {
        need = -1;
        break;
      }
      i++;
    }
    if (-1 == need) {
      printf("%d\n", need);
      continue;
    }
    i = 0;
    j = 0;
    while (g_s2[i]) {
      if (j >= len_s1) {
        j = 0;
      }
      if (0 == j) {
        need++;
      }
      while (j < len_s1) {
        if (g_st[g_s2[i] - 'a'][j] != -1) {
          j = g_st[g_s2[i] - 'a'][j] + 1;
          i++;
          break;
        }
        j = g_st[g_s2[i] - 'a'][j] + 1;
        if (0 == j) {
          need++;
        }
      }
    }
    printf("%d\n", need);
  }
  return 0;
}
