#include <bits/stdc++.h>
using namespace std;
char s1[10001], s2[1000001];
int lens1, lens2;
int P[30][10001];
void precompute() {
  for (int c = 0; c < 26; c++) {
    P[c][lens1] = -1;
    for (int i = lens1 - 1; i >= 0; i--) {
      if (s1[i] == (c + 'a'))
        P[c][i] = i;
      else
        P[c][i] = P[c][i + 1];
    }
  }
}
int main() {
  scanf("%s %s", s1, s2);
  lens1 = strlen(s1);
  lens2 = strlen(s2);
  precompute();
  int ind = 0, ans = 1;
  for (int i = 0; i < lens2; i++) {
    int c = s2[i] - 'a';
    if (P[c][ind] == -1) {
      ans++;
      if (P[c][0] == -1) {
        ans = -1;
        break;
      }
      ind = P[c][0] + 1;
    } else {
      ind = P[c][ind] + 1;
      if (ind == lens1) {
        if (i < lens2 - 1) ans++;
        ind = 0;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
