#include <bits/stdc++.h>
using namespace std;
string s1, s2;
map<char, vector<int> > mp;
int slv() {
  int cc = -1, res = 1;
  for (int i = 0; i < s2.size(); i++) {
    if (mp[s2[i]].size() == 0) return -1;
    if (cc >= (*(mp[s2[i]].end() - 1))) res++, cc = -1;
    cc = *(upper_bound(mp[s2[i]].begin(), mp[s2[i]].end(), cc));
  }
  return res;
}
int main() {
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++) mp[s1[i]].push_back(i);
  cout << slv() << endl;
  return 0;
}
