#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, ans = 1, mi = -1;
  string s1, s2;
  cin >> s1 >> s2;
  vector<int> H1[1000];
  for (i = 0; i < s1.length(); ++i) H1[s1[i]].push_back(i);
  vector<int> ptr(26, -1);
  for (i = 0; i < s2.length(); ++i) {
    if (H1[s2[i]].empty()) {
      puts("-1");
      return 0;
    }
    while (1) {
      ptr[s2[i] - 'a']++;
      if (ptr[s2[i] - 'a'] == H1[s2[i]].size()) {
        ans++;
        for (mi = 0; mi <= 25; ++mi) ptr[mi] = -1;
        ptr[s2[i] - 'a'] = 0;
        mi = H1[s2[i]][0];
        break;
      } else if (H1[s2[i]][ptr[s2[i] - 'a']] > mi) {
        mi = H1[s2[i]][ptr[s2[i] - 'a']];
        break;
      }
    }
  }
  cout << ans << endl;
}
