#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, j, f = 0, count = 1, t, ind = -1;
  vector<vector<int>> v(26);
  string s, s1;
  cin >> s >> s1;
  for (i = 0; i < s.size(); i++) v[s[i] - 'a'].push_back(i);
  for (i = 0; i < s1.size(); i++) {
    t = s1[i] - 'a';
    if (v[t].size() == 0) {
      f = 1;
      break;
    }
    auto it = upper_bound(v[t].begin(), v[t].end(), ind);
    if (it == v[t].end()) {
      count++;
      ind = v[t][0];
    } else
      ind = *it;
  }
  if (f == 1)
    cout << -1 << "\n";
  else
    cout << count << "\n";
  return 0;
}
