#include <bits/stdc++.h>
using namespace std;
long int a[26][10099], b[10099], c, d, e, f, g, h, i, j, k, l, m, n, o, p, c1;
string s1, s2;
int cnum(char c1) { return c1 - 'a'; }
int main() {
  cin >> s1;
  cin >> s2;
  if (s1.empty()) {
    return 0;
  }
  if (s2.empty()) {
    return 0;
  }
  for (i = 0; i <= s1.size(); i++) {
    for (j = 0; j <= 25; j++) {
      a[j][i] = -1;
    }
  }
  a[cnum(s1[s1.size() - 1])][s1.size() - 1] = s1.size() - 1;
  for (i = s1.size() - 1; i >= 0; i--) {
    for (j = 0; j < 26; j++) {
      a[j][i] = a[j][i + 1];
    }
    a[cnum(s1[i])][i] = i;
  }
  c = 0;
  c1 = 0;
  l++;
  for (i = 0; i < s2.size(); i++) {
    p = a[cnum(s2[c])][c1];
    if (p == -1) {
      l++;
      p = a[cnum(s2[c])][0];
    }
    if (p == -1) {
      cout << "-1";
      return 0;
    }
    c1 = p + 1;
    c++;
  }
  cout << l;
  return 0;
}
