#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
int solve(string s, string t) {
  set<int> arr[26];
  for (int i = 0; i < (int)(((long long)s.size())); ++i)
    arr[s[i] - 'a'].insert(i + 1);
  int idx = 0;
  int ret = 1;
  for (int i = 0; i < (int)(((long long)t.size())); ++i) {
    if (arr[t[i] - 'a'].upper_bound(idx) != arr[t[i] - 'a'].end()) {
      idx = (*arr[t[i] - 'a'].upper_bound(idx));
    } else {
      ++ret;
      idx = 0;
      if (arr[t[i] - 'a'].upper_bound(idx) == arr[t[i] - 'a'].end()) return -1;
      idx = (*arr[t[i] - 'a'].upper_bound(idx));
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  cout << solve(s, t) << endl;
  return 0;
}
