#include <bits/stdc++.h>
using namespace std;
string s, t;
vector<int> a[26];
int ans = 1, i, ii, l, uk, r, m;
int main() {
  cin >> s >> t;
  uk = 0;
  for (i = 0; i < s.length(); i++) a[(int)s[i] - 97].push_back(i);
  for (i = 0; i < t.length(); i++) {
    ii = (int)t[i] - 97;
    if (s[uk] == t[i]) {
      uk++;
      if (uk == s.length()) {
        uk = 0;
        ans++;
        if (i == t.length() - 1) ans--;
      }
    } else {
      l = 0;
      r = a[ii].size() - 1;
      while (l < r) {
        m = (l + r) / 2;
        if (a[ii][m] < uk)
          l = m + 1;
        else
          r = m;
      }
      if (a[ii].size() == 0)
        ans = -1;
      else {
        l = a[ii][l];
        if (l < uk) {
          uk = a[ii][0] + 1;
          ans++;
        } else
          uk = l + 1;
        if (uk == s.length()) {
          uk = 0;
          ans++;
          if (t.length() - 1 == i) ans--;
        }
      }
    }
    if (ans == -1) break;
  }
  cout << ans;
  return 0;
}
