#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000000")
using namespace std;
const long long int INF = 2e18;
int nex[20000][35];
int at[35];
int main() {
  string f, s;
  cin >> f >> s;
  memset(nex, -1, sizeof nex);
  memset(at, -1, sizeof at);
  for (int i = 0; i < f.size(); i++) {
    int he = f[i] - 'a';
    if (at[he] == -1) {
      at[he] = i;
    }
  }
  for (int i = f.size() - 1; i >= 0; i--) {
    for (int j = 0; j < 35; j++) {
      nex[i][j] = at[j];
    }
    at[f[i] - 'a'] = i;
  }
  int now = (f[0] == s[0] ? 0 : nex[0][s[0] - 'a']);
  int cur = 0;
  int cnt = 1;
  while (cur < s.size()) {
    if (now == -1) {
      cout << -1;
      return 0;
    }
    cur++;
    if (cur == s.size()) break;
    int gogo = nex[now][s[cur] - 'a'];
    if (gogo == -1) {
      cout << -1;
      return 0;
    }
    if (gogo <= now) {
      cnt++;
    }
    now = gogo;
  }
  cout << cnt;
}
