#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s2;
  int i, j, k, l, m, n, pos = -1, x, ans = 1;
  cin >> s;
  cin >> s2;
  vector<int> s1[26];
  vector<int>::iterator it;
  for (i = 0; i < s.length(); i++) {
    s1[s[i] - 'a'].push_back(i);
  }
  for (i = 0; i < s2.length(); i++) {
    x = s2[i] - 'a';
    it = upper_bound(s1[x].begin(), s1[x].end(), pos);
    if (it == s1[x].end()) {
      if (s1[x].size() == 0) {
        cout << -1;
        return 0;
      }
      pos = -1;
      it = upper_bound(s1[x].begin(), s1[x].end(), pos);
      ans++;
    }
    pos = *it;
  }
  cout << ans;
}
