#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  vector<int> g[26];
  int lenb = b.size();
  int lena = a.size();
  int ans = 1;
  for (int i = 0; i < lena; ++i) {
    g[a[i] - 'a'].push_back(i);
  }
  int l = -1, r = -1;
  for (int i = 0; i < lenb; ++i) {
    if (g[b[i] - 'a'].size() == 0) {
      cout << -1 << endl;
      return 0;
    }
    vector<int>::iterator up;
    up = upper_bound(g[b[i] - 'a'].begin(), g[b[i] - 'a'].end(), r);
    r = g[b[i] - 'a'][(up - g[b[i] - 'a'].begin()) % g[b[i] - 'a'].size()];
    if (l >= r) ++ans;
    l = r;
  }
  cout << ans << endl;
  return 0;
}
