#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s1, s2;
  cin >> s1 >> s2;
  vector<long long> v[26];
  for (long long i = 0; i < ((long long)s1.size()); ++i) {
    v[s1[i] - 'a'].push_back(i + 1);
  }
  for (long long i = 0; i < (26); ++i) {
    sort(v[i].begin(), v[i].end());
  }
  long long curr = -1, cnt = 0;
  for (long long i = 0; i < ((long long)s2.size()); ++i) {
    if (v[s2[i] - 'a'].empty()) {
      cout << -1;
      return;
    }
    if (curr == -1) cnt++;
    curr = upper_bound(v[s2[i] - 'a'].begin(), v[s2[i] - 'a'].end(), curr) -
           v[s2[i] - 'a'].begin();
    if (curr == v[s2[i] - 'a'].size()) {
      curr = v[s2[i] - 'a'][0];
      cnt++;
    } else
      curr = v[s2[i] - 'a'][curr];
  }
  cout << cnt;
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
