#include <bits/stdc++.h>
using namespace std;
vector<int> ch[26];
int main() {
  ios_base::sync_with_stdio(false);
  string a, b;
  cin >> a >> b;
  int n = a.length();
  int m = b.length();
  for (int i = 0; i < n; i++) ch[a[i] - 'a'].push_back(i);
  int ans = 1;
  int ind = -1;
  bool x = false;
  for (int i = 0; i < m; i++) {
    int lo = upper_bound(ch[b[i] - 'a'].begin(), ch[b[i] - 'a'].end(), ind) -
             ch[b[i] - 'a'].begin();
    if (ch[b[i] - 'a'].size() == 0)
      x = true;
    else if (lo < ch[b[i] - 'a'].size())
      ind = ch[b[i] - 'a'][lo];
    else {
      ans++;
      ind = ch[b[i] - 'a'][0];
    }
  }
  if (x)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
