#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
struct Segment {
  int mask;
  int l, r;
} Seg[N * 4];
char s1[N], s2[N * 100];
void push_up(int u, int l, int r) { Seg[u].mask = Seg[l].mask | Seg[r].mask; }
inline int get_int(char ch) { return ch - 'a'; }
void build(int u, int L, int R) {
  Seg[u].mask = 0;
  Seg[u].l = L, Seg[u].r = R;
  if (L == R) {
    Seg[u].mask = (1 << get_int(s1[L]));
  } else {
    int l = u * 2, r = l + 1, mid = (L + R) >> 1;
    build(l, L, mid);
    build(r, mid + 1, R);
    push_up(u, l, r);
  }
}
int seg_query(int u, int L, int R, int fir, int pos) {
  if (fir > R || (Seg[u].mask & (1 << pos)) == 0) return -1;
  if (L == R) {
    return L;
  } else {
    int l = u * 2, r = l + 1, mid = (L + R) >> 1;
    if (fir > mid)
      return seg_query(r, mid + 1, R, fir, pos);
    else {
      if ((Seg[l].mask & (1 << pos)) != 0) {
        int tmp = seg_query(l, L, mid, fir, pos);
        if (tmp != -1) return tmp;
      }
      return seg_query(r, mid + 1, R, fir, pos);
    }
  }
}
void pf(int mask) {
  for (int i = 0; i < 26; i++) {
    if (((1 << i) & mask) != 0)
      printf("%d", 1);
    else
      printf("%d", 0);
  }
  puts("");
}
int main() {
  while (~scanf("%s%s", s1 + 1, s2 + 1)) {
    int n = strlen(s1 + 1);
    build(1, 1, n);
    int res = 0;
    int n2 = strlen(s2 + 1);
    bool ok = true;
    for (int i = 1; i <= n2;) {
      int pos = seg_query(1, 1, n, 1, get_int(s2[i++]));
      if (pos == -1) {
        ok = false;
        break;
      } else {
        res++;
        while (pos != -1) {
          pos = seg_query(1, 1, n, pos + 1, get_int(s2[i++]));
        }
        i--;
      }
    }
    printf("%d\n", ok ? res : -1);
  }
  return 0;
}
