#include <bits/stdc++.h>
using namespace std;
int A[30][10005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s1, s2;
  int i, j, res = 0;
  cin >> s1 >> s2;
  for (j = 0; j < 26; j++) A[j][(int)s1.size()] = -1;
  for (i = (int)s1.size() - 1; i >= 0; i--) {
    for (j = 0; j < 26; j++) A[j][i] = A[j][i + 1];
    A[s1[i] - 'a'][i] = i;
  }
  for (i = 1; i < (int)s1.size(); i++)
    for (j = 0; j < 26; j++)
      if (A[j][i] < 0) A[j][i] = A[j][0];
  for (i = 0, j = -1; i < (int)s2.size(); i++) {
    j = (j + 1) % (int)s1.size();
    if (j == 0) res++;
    if (A[s2[i] - 'a'][j] < 0) {
      cout << "-1";
      return 0;
    }
    if (A[s2[i] - 'a'][j] < j) {
      res++;
      j = A[s2[i] - 'a'][j];
    } else
      j = A[s2[i] - 'a'][j];
  }
  cout << res;
  return 0;
}
