#include <bits/stdc++.h>
using namespace std;
char a[10005];
char b[1000005];
vector<int> poj[10005];
int alen, blen;
long long total;
int pos;
vector<int>::iterator it;
int main() {
  scanf("%s", a);
  scanf("%s", b);
  alen = strlen(a), blen = strlen(b);
  pos = 0;
  total = 1;
  for (int i = 0; i <= alen - 1; i++) {
    poj[a[i] - 'a'].push_back(i);
  }
  for (int i = 0; i <= 25; i++) {
    sort(poj[i].begin(), poj[i].end());
  }
  for (int i = 0; i <= blen - 1; i++) {
    if (poj[b[i] - 'a'].empty()) {
      printf("-1\n");
      return 0;
    }
    it = lower_bound(poj[b[i] - 'a'].begin(), poj[b[i] - 'a'].end(), pos);
    if (it == poj[b[i] - 'a'].end()) {
      it = poj[b[i] - 'a'].begin();
      total++;
    }
    pos = (*it) + 1;
  }
  printf("%d\n", total);
  return 0;
}
