#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int ans = 1;
  int n = s1.length(), m = s2.length();
  map<char, vector<int>> v;
  for (int i = 0; i < n; i++) v[s1[i]].push_back(i);
  int previndex = -1;
  for (int i = 0; i < m; i++) {
    char c = s2[i];
    if (v[c].size() == 0) {
      ans = -1;
      break;
    }
    int ub = upper_bound(v[c].begin(), v[c].end(), previndex) - v[c].begin();
    if (ub == v[c].size()) {
      previndex = v[c][0];
      ans++;
    } else {
      previndex = v[c][ub];
    }
  }
  cout << ans << endl;
  return 0;
}
