#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
const long double pi = acos(-1);
string s, t;
int nxt[100100][30];
int any[30];
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cout << fixed;
  cout.tie(0);
  cin >> s >> t;
  memset(nxt, -1, sizeof(nxt));
  for (int i = int(s.size()) - 1; i >= 0; i--) {
    any[s[i] - 'a'] = 1;
    for (char ch = 'a'; ch <= 'z'; ch++) {
      if (s[i] == ch)
        nxt[i][ch - 'a'] = i;
      else
        nxt[i][ch - 'a'] = nxt[i + 1][ch - 'a'];
    }
  }
  int ind = 0;
  int ans = 1;
  for (int(i) = 0, j123 = int(t.size()); (i) < j123; (i)++) {
    if (!any[t[i] - 'a']) {
      cout << -1 << '\n';
      return 0;
    }
    int nxtind = nxt[ind][t[i] - 'a'];
    if (nxtind == -1) {
      ans++;
      ind = nxt[0][t[i] - 'a'];
    } else {
      ind = nxtind;
    }
    ind++;
  }
  cout << ans << '\n';
}
