#include <bits/stdc++.h>
using namespace std;
char s1[10000 + 7], s2[1000000 + 7];
int dp[10000 + 7][30];
int len1, len2;
inline void init() {
  scanf("%s", s1);
  scanf("%s", s2);
  len1 = strlen(s1);
  len2 = strlen(s2);
  memset(dp, -1, sizeof(dp));
  for (int i = len1 - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      if (s1[i] == 'a' + j)
        dp[i][j] = i;
      else
        dp[i][j] = dp[i + 1][j];
    }
  }
}
inline int slove() {
  int ret = 1;
  int now = 0;
  for (int i = 0; i < len2; i++) {
    now = dp[now][s2[i] - 'a'];
    if (now == -1) {
      ret++;
      now = dp[0][s2[i] - 'a'];
      if (now == -1) return -1;
    }
    now++;
  }
  return ret;
}
int main() {
  init();
  printf("%d\n", slove());
}
