#include <bits/stdc++.h>
using namespace std;
int a[26][11111], b[26];
int main() {
  memset(a, -1, sizeof(a));
  string s1, s2;
  int s = 0, sz1, sz2;
  cin >> s1;
  cin >> s2;
  sz1 = s1.size();
  sz2 = s2.size();
  for (int i = 0; i < sz1; i++) {
    b[s1[i] - 'a'] = 1;
    for (int j = 0; j <= i; j++) {
      if (a[s1[i] - 'a'][j] == -1) {
        a[s1[i] - 'a'][j] = i;
      }
    }
  }
  for (int i = 0; i < sz2; i++)
    if (!b[s2[i] - 'a']) {
      cout << "-1";
      return 0;
    }
  int i = 0, j;
  while (i < sz2) {
    s++;
    j = 0;
    while (i < sz2 && j < sz1 && a[s2[i] - 'a'][j] != -1) {
      j = a[s2[i] - 'a'][j] + 1;
      i++;
    }
  }
  cout << s;
  return 0;
}
