#include <bits/stdc++.h>
using namespace std;
void luck() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
signed main() {
  luck();
  string s, t;
  cin >> s >> t;
  vector<long long> pos[30];
  long long i;
  for (i = 0; i < s.size(); i++) {
    pos[s[i] - 'a'].push_back(i);
  }
  long long cnt = 0, pre_pos = -1, j = 0;
  for (i = 0; i < t.size(); i++) {
    if (!pos[t[i] - 'a'].size()) {
      pre_pos = -1;
      break;
    } else {
      if (i != 0) {
        auto it = upper_bound(pos[t[i] - 'a'].begin(), pos[t[i] - 'a'].end(),
                              pre_pos);
        if (it != pos[t[i] - 'a'].end()) {
          pre_pos = *it;
        } else {
          pre_pos = (pos[t[i] - 'a'][0]);
          cnt++;
        }
      } else {
        pre_pos = (pos[t[i] - 'a'][0]);
        cnt++;
      }
    }
  }
  if (pre_pos != -1) {
    cout << cnt;
  } else {
    cout << -1;
  }
  return 0;
}
