#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  long long res = 1;
  x = x % 1000000007;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = ((res % 1000000007) * (x % 1000000007)) % 1000000007;
    y = y >> 1;
    x = ((x % 1000000007) * (x % 1000000007)) % 1000000007;
  }
  return res;
}
vector<long long> pr;
void sieve(long long n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long i = 2; i <= n; i++)
    if (prime[i]) pr.push_back(i);
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
void we_have_choices() {
  string src, dest;
  cin >> src >> dest;
  long long n = src.length();
  vector<long long> occur[100005];
  for (long long i = 0; i < n; i++) occur[src[i] - 'a'].push_back(i);
  long long p = 0;
  long long c = 1;
  for (long long i = 0; i < dest.length(); ++i) {
    if (occur[dest[i] - 'a'].size() == 0) {
      c = -1;
      break;
    }
    long long next = dest[i] - 'a', sz = occur[next].size() - 1;
    if (occur[next][sz] < p) {
      c++;
      p = occur[next][0] + 1;
    } else {
      long long low = 0, high = sz, mid, ans = 0;
      while (low <= high) {
        mid = (low + high) / 2;
        if (occur[next][mid] >= p)
          ans = mid, high = mid - 1;
        else
          low = mid + 1;
      }
      p = occur[next][ans] + 1;
    }
  }
  cout << c;
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  ;
  long long t = 1;
  while (t--) we_have_choices();
  return 0;
}
