#include <bits/stdc++.h>
using namespace std;
const int Maxn = 10 * 1000 + 10;
int nxt[Maxn][26], ans;
string s1, s2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s1 >> s2;
  int n = (int)s1.size();
  for (int i = 0; i < 26; i++) {
    nxt[n - 1][i] = -1;
    for (int j = 0; j < n; j++)
      if (s1[j] - 'a' == i) {
        nxt[n - 1][i] = j;
        break;
      }
  }
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < 26; j++) nxt[i][j] = nxt[i + 1][j];
    nxt[i][s1[i + 1] - 'a'] = i + 1;
  }
  int pt = 0;
  if (s1[0] != s2[0]) pt = nxt[0][s2[0] - 'a'];
  ans = 1;
  for (int i = 1; i < (int)s2.size(); i++) {
    if (pt == -1) {
      cout << -1 << endl;
      return 0;
    }
    if (pt >= nxt[pt][s2[i] - 'a']) ans++;
    pt = nxt[pt][s2[i] - 'a'];
  }
  cout << ans << endl;
  return 0;
}
