#include <bits/stdc++.h>
using namespace std;
int r[100000 + 1][26];
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int n = s1.size();
  for (int i = 0; i < 26; ++i) r[n - 1][i] = -1;
  for (int i = n - 2; i >= 0; --i) {
    for (int j = 0; j < 26; ++j) r[i][j] = r[i + 1][j];
    r[i][s1[i + 1] - 'a'] = i + 1;
  }
  int res = 1;
  int j;
  if (s2[0] == s1[0])
    j = 0;
  else
    j = r[0][s2[0] - 'a'];
  int i = (j != -1 ? 1 : -1);
  for (; j != -1 && i < (int)s2.size(); ++i) {
    int k = s2[i] - 'a';
    j = r[j][k];
    if (j == -1) {
      if (s2[i] == s1[0])
        j = 0;
      else
        j = r[0][k];
      if (j != -1)
        ++res;
      else
        break;
    }
  }
  if (i < (int)s2.size()) {
    cout << -1;
  } else {
    cout << res;
  }
  return 0;
}
