#include <bits/stdc++.h>
using namespace std;
char a[1000005], b[1000005];
int ai[26];
vector<int> v[26];
int ac() {
  int an = strlen(a);
  int bn = strlen(b);
  for (int i = 0; i < an; ++i) v[a[i] - 'a'].push_back(i);
  int ret = 1, mx = -1;
  for (int j = 0; j < 26; ++j) ai[j] = 0;
  for (int i = 0; i < bn; ++i) {
    int k = b[i] - 'a';
    if (v[k].size() == 0) return -1;
    ++ai[k];
    int nk =
        lower_bound(v[k].begin() + ai[k] - 1, v[k].end(), mx) - v[k].begin();
    ai[k] = nk + 1;
    if (ai[k] > v[k].size()) {
      ++ret;
      for (int j = 0; j < 26; ++j) ai[j] = 0;
      mx = v[k][0];
      ++ai[k];
    } else
      mx = max(mx, v[k][ai[k] - 1]);
  }
  return ret;
}
int main() {
  scanf("%s", a);
  scanf("%s", b);
  printf("%d\n", ac());
  return 0;
}
