#include <bits/stdc++.h>
using namespace std;
long long bs(vector<long long>& v, long long x) {
  long long low = 0;
  long long high = (long long)v.size() - 1;
  if (v[high] <= x) {
    return -1;
  }
  while (high - low > 1) {
    long long mid = low + (high - low) / 2;
    if (v[mid] <= x) {
      low = mid + 1;
    } else {
      high = mid;
    }
  }
  if (v[low] > x)
    return low;
  else
    return high;
}
void solve() {
  string s1, s2;
  cin >> s1 >> s2;
  map<char, vector<long long> > m;
  long long i, j;
  for (i = 0; i < (long long)s1.size(); ++i) {
    m[s1[i]].push_back(i);
  }
  long long temp = 1;
  for (i = 0; i < (long long)s2.size(); ++i) {
    if (m.find(s2[i]) == m.end()) {
      cout << -1 << '\n';
      return;
    }
  }
  long long curr = m[s2[0]][0];
  for (i = 1; i < (long long)s2.size(); ++i) {
    j = upper_bound(m[s2[i]].begin(), m[s2[i]].end(), curr) - m[s2[i]].begin();
    if (j == (long long)m[s2[i]].size()) {
      temp++;
      curr = m[s2[i]][0];
    } else {
      curr = m[s2[i]][j];
    }
  }
  cout << temp << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
