#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
string s1, s2;
vector<int> t[200];
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> s1 >> s2;
  for (int i = 0; i <= s1.size() - 1; i++) {
    int m = int(s1[i]);
    t[m].push_back(i + 1);
  }
  for (int i = 0; i <= s2.size() - 1; i++) {
    a[i] = int(s2[i]);
    if (t[a[i]].size() == 0) {
      cout << -1;
      return 0;
    }
  }
  int res = 1;
  int x = 0, n = s2.size();
  for (int i = 0; i <= n - 1; i++) {
    vector<int>::iterator it =
        lower_bound(t[a[i]].begin(), t[a[i]].end(), x + 1);
    if (it == t[a[i]].end()) {
      x = t[a[i]][0];
      res++;
    } else {
      int k = *it;
      x = k;
    }
  }
  cout << res;
  return 0;
}
