#include <bits/stdc++.h>
using namespace std;
multiset<int> V[140];
int A[140];
string S;
int main() {
  int i, j, k;
  int n;
  while (cin >> S) {
    for (i = 97; i <= 123; i++) {
      V[i].clear();
    }
    n = S.length();
    for (i = 0; i < n; i++) {
      k = S[i];
      V[k].insert(i);
    }
    cin >> S;
    int c = 0;
    for (i = 97; i <= 123; i++) {
      A[i] = 0;
    }
    int l = -1, cost = 1, state = 0;
    for (i = 0; i < S.length(); i++) {
      k = S[i];
      multiset<int>::iterator j = V[k].lower_bound(l);
      if (j == V[k].end()) {
        cost++;
        multiset<int>::iterator j = V[k].lower_bound(0);
        if (j == V[k].end()) {
          state = -1;
          goto Z;
        }
        l = *j;
      } else
        l = *j;
      l++;
    }
  Z:
    if (state == -1)
      cout << state << endl;
    else
      cout << cost << endl;
  }
  return 0;
}
