#include <bits/stdc++.h>
using namespace std;
const long long N_max = 0;
void run_case() {
  long long S1_len, S2_len, i, j, cnt, l, idx;
  string S1, S2;
  cin >> S1;
  S1_len = S1.length();
  cin >> S2;
  S2_len = S2.length();
  vector<long long> V[26];
  for (i = 0; i < S1_len; i++) {
    char c = S1[i];
    V[c - 'a'].push_back(i);
  }
  cnt = 1, l = 0;
  for (i = 0; i < S2_len; i++) {
    char c = S2[i];
    j = lower_bound(V[c - 'a'].begin(), V[c - 'a'].end(), l) -
        V[c - 'a'].begin();
    if (j == V[c - 'a'].size()) {
      cnt += 1;
      l = 0;
      j = lower_bound(V[c - 'a'].begin(), V[c - 'a'].end(), l) -
          V[c - 'a'].begin();
      if (j == V[c - 'a'].size()) {
        cout << "-1\n";
        return;
      }
      idx = V[c - 'a'][j];
      l = (idx + 1);
    } else {
      idx = V[c - 'a'][j];
      l = (idx + 1);
    }
  }
  cout << cnt << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T = 1;
  while (T--) run_case();
  return 0;
}
