#include <bits/stdc++.h>
int next[10005][26];
char c[1000006];
int s[10005];
int t[1000006];
int letter[26];
void init() {
  int i, o, p, j, k;
  scanf("%s", &c[0]);
  for (i = 0; c[i]; ++i) {
    s[++s[0]] = c[i] - 'a';
    ++letter[c[i] - 'a'];
  }
  scanf("%s", &c[0]);
  for (i = 0; c[i]; ++i) t[++t[0]] = c[i] - 'a';
  for (i = 0; i < 26; ++i) {
    if (letter[i] == 0) {
      for (j = 1; j <= s[0]; ++j) next[j][i] = -1;
      continue;
    }
    p = 1;
    while (s[p] != i) ++p;
    for (j = s[0]; j >= 1; --j) {
      if (s[j] == i) p = j;
      next[j][i] = p;
    }
  }
}
int work() {
  int i, o, p, j, k = 1, kk;
  int num = 1;
  for (i = 1; i <= t[0]; ++i) {
    if (next[k][t[i]] == -1) return -1;
    p = next[k][t[i]];
    kk = k;
    k = p + 1;
    if (k > s[0]) k -= s[0];
    if (k <= kk) ++num;
  }
  if (k == 1) --num;
  return (num);
}
int main() {
  init();
  printf("%d\n", work());
  return 0;
}
