#include <bits/stdc++.h>
using namespace std;
vector<int> huruf[300];
string a, b;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++) {
    huruf[a[i]].push_back(i);
  }
  int last = INT_MAX;
  int ans = 0;
  bool ok = 1;
  for (int i = 0; i < b.size(); i++) {
    if (huruf[b[i]].size() == 0) {
      ok = 0;
      break;
    }
    int pos = lower_bound(huruf[b[i]].begin(), huruf[b[i]].end(), last) -
              huruf[b[i]].begin();
    if (pos == huruf[b[i]].size()) {
      ans++;
      last = huruf[b[i]][0] + 1;
    } else {
      last = huruf[b[i]][pos] + 1;
    }
  }
  if (ok)
    cout << ans << '\n';
  else
    cout << -1 << '\n';
  return 0;
}
