#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  set<char> ss1(s1.begin(), s1.end());
  set<char> ss2(s2.begin(), s2.end());
  if (s2.empty()) {
    cout << 0 << endl;
    return 0;
  }
  vector<char> v;
  set_difference(ss2.begin(), ss2.end(), ss1.begin(), ss1.end(),
                 back_inserter(v));
  if (!v.empty()) {
    cout << -1 << endl;
    return 0;
  }
  map<char, vector<size_t> > mc;
  for (size_t i = 0; i < s1.size(); i++) {
    mc[s1[i]].push_back(i);
  }
  size_t ans = 0, pos = 0;
  for (size_t i = 0; i < s2.size(); i++) {
    if (pos == 0) ans++;
    vector<size_t>& v = mc[s2[i]];
    vector<size_t>::iterator itL = lower_bound(v.begin(), v.end(), pos);
    if (itL == v.end()) {
      pos = 0;
      i--;
    } else {
      pos = *itL + 1;
      if (pos == s1.size()) {
        pos = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
