#include <bits/stdc++.h>
const int BUFFSIZE = 10240;
char BUFF[BUFFSIZE + 1], *p = BUFF;
int CHAR, SIGN, BYTES = 0;
using namespace std;
char s1[(int)1e6 + 10];
char s2[(int)1e6 + 10];
vector<int> buf[26];
int main() {
  scanf("%s %s", s1, s2);
  int l1 = strlen(s1);
  int l2 = strlen(s2);
  for (int i = 0; i < l1; i++) buf[s1[i] - 'a'].push_back(i);
  bool f = 1;
  for (int i = 0; i < l2; i++)
    if ((int)buf[s2[i] - 'a'].size() == 0) {
      f = false;
      break;
    }
  if (!f)
    printf("-1\n");
  else {
    int ret = 1;
    int pos = -1;
    for (int j = 0; j < l2; j++) {
      char c = s2[j] - 'a';
      vector<int>::iterator it;
      it = upper_bound(buf[c].begin(), buf[c].end(), pos);
      if (it != buf[c].end())
        pos = *it;
      else {
        ret += 1;
        pos = buf[c][0];
      }
    }
    printf("%d\n", ret);
  }
}
