#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
const int maxm = 1e4 + 7;
char s1[maxn], s2[maxn];
int a[maxn][26], b[26];
int main() {
  ios::sync_with_stdio(false);
  while (cin >> s1 >> s2) {
    int len1 = strlen(s1);
    int len2 = strlen(s2);
    memset(b, 0, sizeof(b));
    memset(a, -1, sizeof(a));
    b[s1[len1 - 1] - 'a']++;
    for (int i = len1 - 2; i >= 0; i--) {
      b[s1[i] - 'a']++;
      for (int j = 0; j < 26; j++)
        a[i][j] = (j == s1[i + 1] - 'a') ? i + 1 : a[i + 1][j];
      a[i][s1[i] - 'a'] = i;
    }
    int flag = 0;
    for (int i = 0; i < len2; i++)
      if (!b[s2[i] - 'a']) {
        flag = 1;
        break;
      }
    if (flag) {
      printf("-1\n");
      continue;
    }
    int ans = 1, j = 0;
    for (int i = 0; i < len2; i++, j = (j + 1) % len1) {
      if (s1[j] != s2[i])
        if (a[j][s2[i] - 'a'] != -1)
          j = a[j][s2[i] - 'a'];
        else {
          ans++;
          j = a[0][s2[i] - 'a'];
        }
      if (j == len1 - 1 && i != len2 - 1) ans++;
    }
    printf("%d\n", ans);
  }
}
