#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long int INFF = 1e17;
const double EPS = 1e-9;
const long long int MOD = 1e9 + 7;
vector<vector<int> > occ(26);
bool p(int mid, int index, int lb, int ub) {
  return occ[index][mid] >= lb && occ[index][mid] <= ub;
}
int bin(int index, int lo, int hi, int lb, int ub) {
  while (lo < hi) {
    int mid = lo + (hi - lo + 1) / 2;
    if (p(mid, index, lb, ub))
      hi = mid - 1;
    else
      lo = mid;
  }
  if (p(lo, index, lb, ub)) return occ[index][lo];
  if (p(lo + 1, index, lb, ub)) return occ[index][lo + 1];
  return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s1, s2;
  bool is[26];
  cin >> s1 >> s2;
  int n = s1.length(), m = s2.length(), ans = 1, start = 0;
  for (int i = (0); i < (26); ++i) is[i] = 0;
  for (int i = (0); i < (n); ++i) {
    is[s1[i] - 'a'] = 1;
    occ[s1[i] - 'a'].push_back(i);
  }
  for (int i = (0); i < (m); ++i)
    if (!is[s2[i] - 'a']) {
      cout << -1 << '\n';
      return 0;
    }
  for (int i = (0); i < (m); ++i) {
    int ret = bin(s2[i] - 'a', 0, occ[s2[i] - 'a'].size() - 1, start, n - 1);
    if (ret != -1)
      start = ret + 1;
    else {
      ans++;
      start = bin(s2[i] - 'a', 0, occ[s2[i] - 'a'].size() - 1, 0, n - 1) + 1;
    }
  }
  cout << ans << '\n';
  return 0;
}
