#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
vector<int> s1[26];
vector<int>::iterator it;
char s[maxn / 10], s2[maxn * 10];
int main() {
  for (int i = 'a'; i <= 'z'; i++) s1[i - 'a'].clear();
  scanf("%s", s);
  scanf("%s", s2);
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    s1[s[i] - 'a'].push_back(i);
  }
  bool flag = false;
  int cnt = 1, alp, pos = -1, len2 = strlen(s2);
  for (int i = 0; i < len2; i++) {
    alp = s2[i] - 'a';
    it = upper_bound(s1[alp].begin(), s1[alp].end(), pos);
    if (it == s1[alp].end()) {
      if (s1[alp].size() == 0) {
        flag = true;
        break;
      }
      pos = -1;
      it = upper_bound(s1[alp].begin(), s1[alp].end(), pos);
      cnt++;
    }
    pos = *it;
  }
  if (flag) cnt = -1;
  printf("%d\n", cnt);
  return 0;
}
