#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
const double eps = 0.00000001;
void solve() {
  string s1, s2;
  cin >> s1 >> s2;
  int lim1 = (int)s1.size();
  int lim2 = (int)s2.size();
  int next[lim1 + 1][26];
  int res = 1, ind = 0;
  for (int j = 0; j < 26; j++) {
    next[lim1][j] = inf;
  }
  for (int i = lim1 - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) next[i][j] = next[i + 1][j];
    next[i][s1[i] - 'a'] = i;
  }
  int cur;
  for (int i = 0; i < lim2; i++) {
    cur = s2[i] - 'a';
    if (next[0][cur] == inf) {
      res = -1;
      break;
    }
    if (next[ind][cur] == inf) {
      ind = 0;
      res++;
    }
    ind = next[ind][cur] + 1;
  }
  cout << res << endl;
}
int main() { solve(); }
