#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000005;
int pos[30][10005], num[30], l1, l2;
char s[MAX], t[MAX];
bool flag[30], in_t[30];
int get(int x, int i) {
  int l = 0, mid, r = num[x] + 1;
  while (l + 1 < r) {
    mid = (l + r) >> 1;
    if (pos[x][mid] >= i)
      r = mid;
    else
      l = mid;
  }
  if (r == num[x] + 1) return l1;
  return pos[x][r];
}
int main() {
  int i, j, cnt;
  while (scanf("%s%s", s, t) != EOF) {
    cnt = 0;
    l1 = strlen(s);
    l2 = strlen(t);
    memset(flag, false, sizeof(flag));
    for (i = 0; i < l1; i++) {
      flag[s[i] - 'a'] = true;
    }
    bool ok = true;
    for (i = 0; i < l2; i++) {
      if (!flag[t[i] - 'a']) {
        ok = false;
        break;
      }
    }
    if (!ok) {
      puts("-1");
      continue;
    }
    memset(num, 0, sizeof(num));
    for (i = 0; i < l1; i++) {
      j = s[i] - 'a';
      num[j]++;
      pos[j][num[j]] = i;
    }
    for (i = 0; i < 26; i++) {
      num[i]++;
      pos[i][num[i]] = l1;
    }
    i = j = 0;
    while (j < l2) {
      if (i == 0) cnt++;
      i = get(t[j] - 'a', i);
      if (i == l1)
        i = 0;
      else {
        i++;
        j++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
