#include <bits/stdc++.h>
using namespace std;
template <typename T>
void pv(T a, T b) {
  for (T i = a; i <= b; ++i) cout << *i << " ";
  cout << endl;
}
template <typename T>
void chmin(T &t, const T &f) {
  if (t > f) t = f;
}
template <typename T>
void chmax(T &t, const T &f) {
  if (t < f) t = f;
}
template <typename T>
T in() {
  T x = 0;
  T p = 1;
  char c;
  do {
    c = getchar();
  } while (c <= 32);
  if (c == '-') {
    p = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - 48;
    c = getchar();
  }
  return x * p;
}
const int LIM = 1000100;
int n, m, i, p, ans;
char s[LIM], t[LIM];
vector<int> v[30];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  scanf("%s", t + 1);
  m = strlen(t + 1);
  for (i = 1; i <= n; ++i) {
    v[s[i] - 'a'].push_back(i);
  }
  p = 0;
  ans = 1;
  for (i = 1; i <= m; ++i) {
    if (v[t[i] - 'a'].empty()) {
      puts("-1");
      return 0;
    }
    if (v[t[i] - 'a'].back() <= p) {
      ++ans;
      p = v[t[i] - 'a'][0];
    } else
      p = *(lower_bound(v[t[i] - 'a'].begin(), v[t[i] - 'a'].end(), p + 1));
  }
  printf("%d\n", ans);
  return 0;
}
