#include <bits/stdc++.h>
using namespace std;
inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a < b ? a : b; }
char s1[10005], s2[1000005];
struct node {
  int l[30], r[30];
  node() {
    memset(l, -1, sizeof(l));
    memset(r, -1, sizeof(r));
  }
  void clear() {
    memset(l, -1, sizeof(l));
    memset(r, -1, sizeof(r));
  }
} nod[10005];
int chl[30], chr[30];
int main() {
  while (gets(s1) && gets(s2)) {
    int l1(strlen(s1)), l2(strlen(s2));
    memset(chl, -1, sizeof(chl));
    memset(chr, -1, sizeof(chr));
    for (int i(0); i < (l1); ++i) {
      nod[i].clear();
      for (int j(0); j < (26); ++j) {
        nod[i].l[j] = chl[j];
        if (s1[i] - 'a' == j && chl[j] == -1) chl[j] = i;
      }
    }
    for (int i(l1 - 1); i >= 0; --i)
      for (int j(0); j < (26); ++j) {
        nod[i].r[j] = chr[j];
        if (s1[i] - 'a' == j) chr[j] = i;
      }
    int res(1), loc(-1);
    for (int i(0); i < (l2); ++i) {
      ++loc;
      if (loc == l1) {
        loc = 0;
        res++;
      }
      if (s1[loc] == s2[i])
        continue;
      else if (nod[loc].r[s2[i] - 'a'] != -1)
        loc = nod[loc].r[s2[i] - 'a'];
      else if (nod[loc].l[s2[i] - 'a'] != -1)
        loc = nod[loc].l[s2[i] - 'a'], ++res;
      else {
        res = -1;
        break;
      }
    }
    printf("%d\n", res);
  }
}
