#include <bits/stdc++.h>
using namespace std;
long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const long long maxn = 1e5 + 10;
vector<long long> pos[maxn];
int32_t main() {
  string s, t;
  cin >> s >> t;
  for (long long i = 0; i < s.size(); i++) pos[s[i] - 'a'].push_back(i);
  long long ans = 0;
  long long cur = 0;
  while (ans < t.size() && cur < t.size()) {
    ans++;
    long long where = 0;
    while (where < s.size() && cur < t.size()) {
      long long need = t[cur] - 'a';
      long long low = lower_bound(pos[need].begin(), pos[need].end(), where) -
                      pos[need].begin();
      if (low == pos[need].size()) break;
      low = pos[need][low];
      cur++;
      where = low + 1;
    }
  }
  if (cur == t.size())
    cout << ans << endl;
  else
    cout << -1 << endl;
}
