#include <bits/stdc++.h>
using namespace std;
vector<int> v[26];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s1;
  string s2;
  cin >> s1 >> s2;
  for (int i = 0; i < s1.length(); i++) v[s1[i] - 'a'].push_back(i);
  for (int i = 0; i < s2.length(); i++)
    if (!v[s2[i] - 'a'].size()) {
      cout << "-1" << endl;
      return 0;
    }
  int ans = 1;
  int j = v[s2[0] - 'a'][0];
  vector<int>::iterator it;
  for (int i = 1; i < s2.length(); i++) {
    it = upper_bound(v[s2[i] - 'a'].begin(), v[s2[i] - 'a'].end(), j);
    if (it == v[s2[i] - 'a'].end()) {
      ans++;
      j = v[s2[i] - 'a'][0];
    } else
      j = *it;
  }
  cout << ans << endl;
  return 0;
}
