#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double EPS = 1e-9;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  set<char> x;
  map<char, vector<int> > oc;
  for (int i = 0; i < (int)s1.size(); i++) {
    x.insert(s1[i]);
    oc[s1[i]].push_back(i);
  }
  for (int i = 0; i < (int)s2.size(); i++)
    if (x.find(s2[i]) == x.end()) {
      cout << -1;
      return 0;
    }
  int lst_idx = -1;
  int ans = 1;
  for (int i = 0; i < (int)s2.size(); i++) {
    char cur = s2[i];
    int nxt = lower_bound(oc[cur].begin(), oc[cur].end(), lst_idx + 1) -
              oc[cur].begin();
    if (nxt >= (int)oc[cur].size()) {
      ans++;
      lst_idx = -1;
      nxt = lower_bound(oc[cur].begin(), oc[cur].end(), lst_idx + 1) -
            oc[cur].begin();
    }
    lst_idx = oc[cur][nxt];
  }
  cout << ans;
  return 0;
}
