#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
const int MM = 998244353;
const long double PI = acos(-1);
const long long INF = 2e18;
template <typename T, typename T1>
void amax(T &a, T1 b) {
  if (b > a) a = b;
}
template <typename T, typename T1>
void amin(T &a, T1 b) {
  if (b < a) a = b;
}
long long power(long long b, long long e) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b, e / 2);
  return power(b * b, e / 2);
}
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b % m, e / 2, m) % m;
  return power(b * b % m, e / 2, m);
}
long long modinv(long long a, long long m) { return power(a, m - 2, m); }
vector<vector<long long>> v;
int TLE_TERROR() {
  string s, d;
  cin >> s >> d;
  long long n = s.length();
  long long x = -1, ans = 1;
  v.resize(26);
  for (long long i = 0; i < s.length(); i++) v[s[i] - 'a'].push_back(i);
  for (long long i = 0; i < d.length(); i++) {
    if (v[d[i] - 'a'].empty()) {
      cout << -1;
      return 0;
    }
  }
  for (long long i = 0; i < d.length(); i++) {
    auto it = upper_bound(v[d[i] - 'a'].begin(), v[d[i] - 'a'].end(), x);
    if (it == v[d[i] - 'a'].end()) {
      ans++;
      x = v[d[i] - 'a'][0];
      continue;
    }
    long long z = it - v[d[i] - 'a'].begin();
    x = v[d[i] - 'a'][z];
  }
  cout << ans;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int TESTS = 1;
  while (TESTS--) TLE_TERROR();
  return 0;
}
