#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string foo, bar;
  cin >> foo >> bar;
  vector<vector<int>> fa(26);
  for (int i = 0; i < (int)foo.length(); ++i) {
    int c = foo[i] - 'a';
    fa[c].push_back(i);
  }
  int last = -1;
  int res = 1;
  for (char c : bar) {
    int x = c - 'a';
    auto it = upper_bound(fa[x].begin(), fa[x].end(), last);
    if (it == fa[x].end()) {
      last = -1;
      it = lower_bound(fa[x].begin(), fa[x].end(), last);
      res++;
      if (it == fa[x].end()) {
        cout << -1 << '\n';
        return 0;
      }
      last = *it;
    } else {
      last = *it;
    }
  }
  cout << res << '\n';
  return 0;
}
