#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  int n, m;
  cin >> s1 >> s2;
  n = s1.length();
  m = s2.length();
  map<char, set<int> > mp;
  for (int i = 0; i < n; i++) {
    mp[s1[i]].insert(i);
  }
  int curr = 0;
  int ans = 1;
  for (int i = 0; i < m; i++) {
    char ch = s2[i];
    auto it = mp[ch].lower_bound(curr);
    if (it == mp[ch].end()) {
      ++ans, curr = 0;
      it = mp[ch].lower_bound(curr);
      if (it == mp[ch].end()) {
        cout << "-1\n";
        return 0;
      }
    }
    curr = *it + 1;
  }
  cout << ans << endl;
  return 0;
}
