#include <bits/stdc++.h>
using namespace std;
map<char, int> m;
map<char, int> m1;
map<int, map<char, int>> m2;
char alp[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
                'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
void best(string s1) {
  for (int i = 0; i < 26; i++) {
    m2[s1.size() - 1][alp[i]] = -1;
  }
  m2[s1.size() - 1][s1[s1.size() - 1]] = s1.size() - 1;
  for (long long int i = s1.size() - 2; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      m2[i][alp[j]] = m2[i + 1][alp[j]];
    }
    m2[i][s1[i]] = i;
  }
}
int main() {
  string s1;
  string s2;
  int flag = 1, c = 1;
  cin >> s1 >> s2;
  for (long long int i = 0; i < 26; i++) {
    m[alp[i]] = 0;
  }
  for (long long int i = 0; i < s1.size(); i++) {
    m[s1[i]] = 1;
  }
  for (long long int i = 0; i < s2.size(); i++) {
    if (m[s2[i]] == 0) {
      flag = 0;
    }
  }
  if (flag == 0) {
    cout << -1;
  } else {
    best(s1);
    long long int i = 0, j = 0;
    while (i < s2.size()) {
      if (s2[i] == s1[j]) {
        i++;
        j++;
        if (j == s1.size() and i != s2.size()) {
          c++;
          j = m2[0][s2[i]];
        }
      } else {
        j = m2[j][s2[i]];
        if (j == -1) {
          j = m2[0][s2[i]];
          c++;
        }
        j++;
        i++;
        if (j == s1.size() and i != s2.size()) {
          c++;
          j = m2[0][s2[i]];
        }
      }
    }
    cout << c << endl;
  }
}
