#include <bits/stdc++.h>
using namespace std;
const int Max = 1e4 + 10;
const int Mod = 1e9 + 7;
const long long int Inf = 1LL << 62;
int nxt[Max][1 << 6];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s1, s2;
  cin >> s1 >> s2;
  int n = s1.size();
  int m = s2.size();
  memset(nxt, -1, sizeof nxt);
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      nxt[i][j] = nxt[i + 1][j];
    }
    nxt[i][s1[i] - 'a'] = i;
  }
  int cnt = 1, cur = 0;
  for (int i = 0; i < m; i++) {
    if (nxt[cur][s2[i] - 'a'] == -1) {
      cnt++;
      if (nxt[0][s2[i] - 'a'] == -1) {
        cout << -1 << endl;
        return 0;
      }
      cur = 0;
    }
    cur = nxt[cur][s2[i] - 'a'] + 1;
  }
  cout << cnt << endl;
  return 0;
}
