#include <bits/stdc++.h>
using namespace std;
string s1, s2;
vector<vector<int> > pos('a' + 26);
int main() {
  cin >> s1 >> s2;
  int ans = 1;
  for (int i = 0; i < s1.size(); ++i) {
    pos[s1[i]].push_back(i);
  }
  int curp = 0;
  vector<int>::iterator it;
  for (int i = 0; i < s2.size(); i++) {
    if (pos[s2[i]].size() == 0) {
      cout << -1;
      return 0;
    }
    it = lower_bound(pos[s2[i]].begin(), pos[s2[i]].end(), curp);
    if (it != pos[s2[i]].end()) {
      curp = *it + 1;
    } else {
      --i;
      curp = 0;
      ans++;
    }
  }
  cout << ans;
  return 0;
}
