#include <bits/stdc++.h>
using namespace std;
int a[26][10005];
int b[26];
char str[1000006];
int main() {
  char c;
  int t, n, i, st, ed, mid, pos, ans;
  bool f;
  while (scanf("%c", &c) != EOF) {
    memset(b, 0, sizeof(b));
    t = c - 'a';
    a[t][b[t]++] = 0;
    n = 0;
    for (n = 1;; n++) {
      scanf("%c", &c);
      if (c == '\n') break;
      t = c - 'a';
      a[t][b[t]++] = n;
    }
    n = 0;
    while (scanf("%c", &c)) {
      if (c == '\n') break;
      str[n++] = c;
    }
    pos = -1;
    f = true;
    ans = 1;
    for (i = 0; i < n; i++) {
      t = str[i] - 'a';
      if (b[t] == 0) {
        f = false;
        ans = -1;
        break;
      }
      if (a[t][b[t] - 1] <= pos) {
        pos = a[t][0];
        ans++;
      } else if (a[t][0] > pos) {
        pos = a[t][0];
      } else {
        st = 0, ed = b[t] - 1;
        while (ed - st > 1) {
          mid = (ed + st) / 2;
          if (a[t][mid] > pos)
            ed = mid;
          else
            st = mid;
        }
        pos = a[t][ed];
      }
    }
    cout << ans << endl;
  }
}
