#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int diri[4] = {-1, 0, 1, 0};
const int dirj[4] = {0, 1, 0, -1};
int main() {
  string a, b;
  cin >> a >> b;
  long long na = a.size(), nb = b.size();
  vector<vector<long long> > mat(2 * na, vector<long long>(26, -1));
  mat[2 * na - 1][a[na - 1] - 'a'] = 0;
  for (int i = 2 * na - 2; i >= 0; --i) {
    for (int j = 0; j < 26; ++j) {
      if (j == a[i % na] - 'a')
        mat[i][j] = 0;
      else if (mat[i + 1][j] != -1)
        mat[i][j] = 1 + mat[i + 1][j];
    }
  }
  long long p = 0;
  for (int i = 0; i < nb; ++i) {
    long long d = mat[p % na][b[i] - 'a'];
    if (d == -1) {
      cout << -1 << endl;
      return 0;
    }
    p += d + 1;
  }
  cout << (p + na - 1) / na << endl;
}
