#include <bits/stdc++.h>
using namespace std;
template <typename _Ty1, typename _Ty2>
std::ostream &operator<<(std::ostream &_os, const std::pair<_Ty1, _Ty2> &_p) {
  _os << '(' << _p.first << ',' << _p.second << ')';
  return _os;
}
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  vector<vector<int>> nextc(26, vector<int>(s1.size(), -1));
  for (int i = 0; i < s1.size(); ++i) {
    int c = s1[i] - 'a';
    for (int k = i; k >= 0 and nextc[c][k] == -1; k--) {
      nextc[c][k] = i;
    }
  }
  int total = 1;
  int nextpos = 0;
  for (int i = 0; i < (int)s2.size(); i++) {
    int c = s2[i] - 'a';
    nextpos = nextc[c][nextpos] + 1;
    if (nextpos == 0) {
      total++;
      nextpos = nextc[c][0] + 1;
      if (nextpos == 0) {
        cout << "-1\n";
        return 0;
      }
    }
    if (nextpos == s1.size() and i < s2.size() - 1) {
      total++;
      nextpos = 0;
    }
  }
  cout << total << '\n';
}
