#include <bits/stdc++.h>
using namespace std;
int to[20360][50];
char s[20360], t[2036000];
int n, m;
int idx[50];
int main() {
  memset(to, -1, sizeof(to));
  scanf("%s%s", s, t);
  n = strlen(s);
  m = strlen(t);
  memset(idx, -1, sizeof(idx));
  for (int i = n - 1; i >= 0; i--) {
    int c = s[i] - 'a';
    if (idx[c] == -1 || idx[c] > i + n) idx[c] = i + n;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int k = 0; k < 26; k++) to[i][k] = idx[k] % n;
    idx[s[i] - 'a'] = i;
  }
  int ans = -1, id = -1;
  for (int i = (0); i < (int)(n); i++)
    if (s[i] == t[0]) {
      id = i;
      ans = 1;
      break;
    }
  if (id != -1)
    for (int i = (0); i < (int)(m - 1); i++) {
      int ne = to[id][t[i + 1] - 'a'];
      if (ne == -1) {
        ans = -1;
        break;
      }
      ans += (ne > id ? 0 : 1);
      id = ne;
    }
  printf("%d\n", ans);
  return 0;
}
