#include <bits/stdc++.h>
using namespace std;
char s1[10010], s2[1000010];
vector<vector<int> > g;
int main() {
  scanf("%s%s", &s1, &s2);
  int n = strlen(s1);
  int m = strlen(s2);
  g.resize(26);
  for (int i = (0); i < (n); ++i) g[s1[i] - 'a'].push_back(i);
  int cur = -1;
  int res = 1;
  for (int i = (0); i < (m); ++i) {
    int k = s2[i] - 'a';
    int l = 0;
    int r = (int)g[k].size();
    r--;
    int best = -1;
    if (g[k].size() == 0) {
      printf("-1\n");
      return 0;
    }
    while (l <= r) {
      int m = (l + r) / 2;
      if (g[k][m] > cur) {
        best = m;
        r = m - 1;
      } else
        l = m + 1;
    }
    if (best == -1) {
      res++;
      cur = g[k][0];
    } else
      cur = g[k][best];
  }
  printf("%d\n", res);
  return 0;
}
