#include <bits/stdc++.h>
using namespace std;
const int SIZE = 11000;
char S1[SIZE], S2[SIZE * 100];
int A[SIZE][150], len1, len2;
int main() {
  cin >> S1 >> S2;
  len1 = strlen(S1), len2 = strlen(S2);
  S1[len1] = 'A';
  len1++;
  for (int i = 0; i != len1; i++)
    for (int j = 'a'; j != 'z' + 1; j++) {
      if (i == 0 || S1[i] == j) {
        int k;
        for (k = i + 1; k != i; k = (k + 1) % len1)
          if (S1[k] == j) {
            A[i][j] = k;
            break;
          }
        if (k == i) {
          if (S1[i] == j)
            A[i][j] = i;
          else
            A[i][j] = -1;
        }
      } else
        A[i][j] = A[i - 1][j];
    }
  int p1 = len1 - 1, r = 0, newp1;
  for (int p2 = 0; p2 != len2; p2++) {
    newp1 = A[p1][S2[p2]];
    if (newp1 == -1) {
      r = -1;
      break;
    } else if (newp1 <= p1)
      r++;
    p1 = newp1;
  }
  cout << r;
  return 0;
}
