#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  vector<int> s1Vec[30];
  int s1Size = s1.size();
  for (int i = 0; i < s1Size; ++i) s1Vec[s1[i] - 'a'].push_back(i);
  int ret = 1;
  int index = -1;
  int s2Size = s2.size();
  for (int i = 0; i < s2Size; ++i) {
    if (s1Vec[s2[i] - 'a'].empty()) {
      cout << -1 << endl;
      return 0;
    }
    const vector<int>& vec = s1Vec[s2[i] - 'a'];
    int vecSize = vec.size();
    int end = vecSize;
    int start = 0;
    while (end > start) {
      int mid = (end + start) >> 1;
      if (vec[mid] == index) {
        end = ++mid;
        break;
      }
      if (vec[mid] > index)
        end = mid;
      else
        start = ++mid;
    }
    index = end == vecSize ? vec[0] : vec[end];
    end == vecSize ? ++ret : ret;
  }
  cout << ret << endl;
  return 0;
}
