#include <bits/stdc++.h>
using namespace std;
string s, p;
set<int> nem[1000];
vector<int> v[1000];
int find(int x, int y) {
  int p = 0, q = v[x].size();
  while (p < q) {
    int r = (p + q) / 2;
    if (v[x][r] < y)
      p = r + 1;
    else
      q = r;
  }
  return p;
}
int main() {
  cin >> p >> s;
  for (int i = 0; i < p.length(); i++) v[p[i]].push_back(i);
  int i = 1;
  int ja = 0;
  for (;; i++) {
    int t = ja;
    int k = 0;
    while (k != p.length()) {
      int nem = find(s[ja], k);
      if (nem != v[s[ja]].size()) {
        k = v[s[ja]][nem] + 1;
        ja++;
      } else
        k = p.length();
      if (ja == s.length()) break;
    }
    if (ja == s.length()) break;
    if (t == ja) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << i << endl;
}
