#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s1, s2;
  cin >> s1 >> s2;
  int cnt[2][30];
  memset(cnt, 0, sizeof cnt);
  for (int i = 0; i < int(s1.size()); ++i) cnt[0][s1[i] - 'a']++;
  for (int i = 0; i < int(s2.size()); ++i) cnt[1][s2[i] - 'a']++;
  vector<int> alpha[30];
  for (int i = 0; i < int(s1.size()); ++i) alpha[s1[i] - 'a'].push_back(i);
  for (char ch = 'a'; ch <= 'z'; ++ch)
    if (cnt[1][ch - 'a'] && !cnt[0][ch - 'a']) {
      cout << -1 << endl;
      return;
    }
  int ans = 1, pos = -1;
  for (int p2 = 0; p2 < int(s2.size()); ++p2) {
    char ch = s2[p2];
    vector<int> &vec = alpha[ch - 'a'];
    vector<int>::const_iterator it =
        lower_bound(vec.begin(), vec.end(), pos + 1);
    if (it == vec.end()) {
      ans++;
      pos = vec[0];
    } else
      pos = *it;
  }
  cout << ans << endl;
}
int main() { solve(); }
