#include <bits/stdc++.h>
using namespace std;
const long long N = 1e9;
const long long NN = 1e18;
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;
template <typename T, typename T1>
T maxn(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T minn(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
void solve() {
  string second, t;
  cin >> second >> t;
  long long int ans = 0;
  long long int cnt[26];
  memset(cnt, (0), sizeof((cnt)));
  vector<long long int> ind[26];
  for (long long int(i) = 0; (i) < ((long long int)second.size()); (i)++)
    cnt[second[i] - 'a'] = 1, ind[second[i] - 'a'].emplace_back(i);
  for (auto z : t) {
    if (cnt[z - 'a'] == 0) {
      cout << -1;
      return;
    }
  }
  for (long long int(i) = 0; (i) < ((long long int)t.size()); (i)++) {
    char c = t[i];
    long long int curr = ind[c - 'a'][0];
    ans++;
    i++;
    while (i < (long long int)t.size()) {
      c = t[i];
      auto it = upper_bound(ind[c - 'a'].begin(), ind[c - 'a'].end(), curr);
      if (it != ind[c - 'a'].end()) {
        curr = *it;
        i++;
      } else {
        i--;
        break;
      }
    }
  }
  cout << ans;
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int testcase = 1;
  while (testcase--) solve();
  return 0;
}
