#include <bits/stdc++.h>
using namespace std;
inline double Time() { return ((clock() * 1.0) / CLOCKS_PER_SEC); }
const int N = 100500;
int n[3], cnt[N / 10][123], ans;
string s[3];
int _find(int left, char ch) {
  int rec = 0;
  int l = left + 1;
  int r = n[1];
  while (l <= r) {
    int mid = (l + r) / 2;
    if (cnt[mid][ch] - cnt[left][ch] > 0) {
      rec = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  return rec;
}
int main() {
  srand(time(NULL));
  cin >> s[1] >> s[2];
  n[1] = s[1].size();
  n[2] = s[2].size();
  for (int i = 1; i <= n[1]; i++) {
    for (int j = 'a'; j <= 'z'; j++) {
      cnt[i][j] = cnt[i - 1][j];
    }
    cnt[i][s[1][i - 1]]++;
  }
  for (int i = 1; i <= n[2]; i++) {
    ans++;
    int left = _find(0, s[2][i - 1]);
    if (!left) {
      cout << -1;
      return 0;
    }
    int pos = i + 1;
    left = _find(left, s[2][pos - 1]);
    while (left && pos <= n[2]) {
      pos++;
      left = _find(left, s[2][pos - 1]);
    }
    i = pos - 1;
  }
  cout << ans;
  return 0;
}
