#include <bits/stdc++.h>
using namespace std;
const int MAX_CHAR = 26;
string s1, s2;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> s1 >> s2;
  map<char, vector<int>> _map;
  for (int i = 0; i < (int)s1.size(); i++) {
    _map[s1[i]].push_back(i);
  }
  for (auto v : s2) {
    if ((int)_map[v].size() == 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  int res = 1, prev = 0;
  for (int i = 0; i < (int)s2.size(); i++) {
    auto idx = lower_bound(_map[s2[i]].begin(), _map[s2[i]].end(), prev);
    if (idx != _map[s2[i]].end()) {
      prev = *idx + 1;
    } else {
      prev = *lower_bound(_map[s2[i]].begin(), _map[s2[i]].end(), 0) + 1;
      res++;
    }
  }
  cout << res << endl;
  return 0;
}
