#include <bits/stdc++.h>
using namespace std;
using namespace std;
string s1, s2;
queue<int> fila[30];
int prox[10010][30];
int main() {
  cin >> s1 >> s2;
  int t1 = s1.size(), t2 = s2.size(), ini, ret = 1;
  bool val = true;
  memset(prox, -1, sizeof(prox));
  for (int i = int(0); i <= int(t1 - 1); i++) {
    while (!fila[s1[i] - 'a'].empty())
      prox[fila[s1[i] - 'a'].front()][s1[i] - 'a'] = i, fila[s1[i] - 'a'].pop();
    for (int j = int(0); j <= int(25); j++) fila[j].push(i);
  }
  for (int i = int(0); i <= int(t1 - 1); i++)
    while (!fila[s1[i] - 'a'].empty())
      prox[fila[s1[i] - 'a'].front()][s1[i] - 'a'] = i, fila[s1[i] - 'a'].pop();
  for (ini = 0; ini < t1 && s1[ini] != s2[0]; ini++)
    ;
  if (ini == t1)
    puts("-1");
  else {
    for (int j = int(1); j <= int(t2 - 1); j++) {
      if (prox[ini][s2[j] - 'a'] == -1) {
        val = false;
        break;
      }
      if (prox[ini][s2[j] - 'a'] <= ini) ret++;
      ini = prox[ini][s2[j] - 'a'];
    }
    if (val)
      printf("%d\n", ret);
    else
      puts("-1");
  }
  return 0;
}
