#include <bits/stdc++.h>
using namespace std;
char src[100005], dest[1000005];
vector<int> occur[30];
int l1, l2, c = 1, p = 0;
int main() {
  scanf("%s%s", src, dest);
  l1 = strlen(src), l2 = strlen(dest);
  for (int i = 0; i < l1; ++i) {
    occur[src[i] - 'a'].push_back(i);
  }
  for (int i = 0; i < l2; ++i) {
    int next = dest[i] - 'a', sz = occur[next].size() - 1;
    if (sz == -1) {
      c = -1;
      break;
    }
    if (occur[next][sz] < p) {
      c++;
      p = occur[next][0] + 1;
    } else {
      int low = 0, high = sz, mid;
      while (low < high) {
        mid = (low + high) / 2;
        if (occur[next][mid] >= p)
          high = mid;
        else
          low = mid + 1;
      }
      p = occur[next][low] + 1;
    }
  }
  printf("%d\n", c);
}
