#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int n1, n2;
char s1[10001];
char s2[1000001];
int nxt[1000002][26];
void solution() {
  gets(s1);
  gets(s2);
  int n1 = strlen(s1);
  int n2 = strlen(s2);
  for (int i = 0, _n = (26); i < _n; ++i) nxt[n1][i] = 0x7f7f7f7f;
  for (int i = n1 - 1; i >= 0; i--) {
    for (int j = 0, _n = (26); j < _n; ++j) nxt[i][j] = nxt[i + 1][j];
    nxt[i][s1[i] - 'a'] = i;
  }
  int ret = 1, pos = 0;
  for (int i = 0; i < n2; i++) {
    int c = s2[i] - 'a';
    if (pos == 0x7f7f7f7f || nxt[pos][c] == 0x7f7f7f7f) {
      if (pos == 0x7f7f7f7f) {
        pos = 0, ret++;
      }
      if (nxt[0][c] == 0x7f7f7f7f) {
        ret = -1;
        break;
      }
      ret++;
      pos = 0;
    }
    pos = nxt[pos][c] + 1;
  }
  cout << ret << endl;
}
int main() {
  solution();
  return 0;
}
