#include <bits/stdc++.h>
using namespace std;
long long int modexp(long long int a, long long int n) {
  long long int r = 1;
  while (n) {
    if (n & 1) r = (r * a) % 1000000007;
    a = (a * a) % 1000000007;
    n >>= 1;
  }
  return r;
}
long long int stoi(string s) {
  long long int ans = 0;
  long long int t = 1;
  for (int i = s.size() - 1; i >= 0; i--) ans += (s[i] - '0') * t, t *= 10;
  return ans;
}
long long int ans[100006][26];
string s1, s2;
long long int x[26];
void pre() {
  fill(x, x + 26, -1);
  for (int i = s1.size() - 1; i >= 0; i--) {
    x[s1[i] - 'a'] = i;
    for (int j = 0; j < 26; j++) ans[i][j] = x[j];
  }
}
void solve() {
  cin >> s1 >> s2;
  pre();
  long long int c = 0;
  for (int i = 0; i < s2.size(); i++) {
    if (ans[0][s2[i] - 'a'] >= 0) c++;
  }
  if (c < s2.size()) {
    cout << -1;
    return;
  }
  long long int j = 0, i = 0, p = 1;
  while (i < s2.size()) {
    long long int x = s2[i] - 'a';
    if (ans[j][x] >= 0)
      i++, j = ans[j][x] + 1;
    else
      j = 0, p++;
    if (j >= s1.size()) j = 0, p++;
  }
  if (j == 0) p--;
  cout << p;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
