#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e6 + 5;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string s1, s2;
  cin >> s1 >> s2;
  long long prev = 0;
  map<char, set<long long> > gm;
  for (int i = 0; i < s1.size(); i++) {
    gm[s1[i]].insert(i + 1);
  }
  long long cnt = 0;
  for (int i = 0; i < s2.size(); i++) {
    if (gm[s2[i]].upper_bound(prev) != gm[s2[i]].end() && !gm[s2[i]].empty()) {
      prev = (*gm[s2[i]].upper_bound(prev));
    } else if (!gm[s2[i]].empty() &&
               gm[s2[i]].upper_bound(prev) == gm[s2[i]].end())
      cnt++, prev = 0, prev = (*gm[s2[i]].upper_bound(prev));
    else if (gm[s2[i]].empty()) {
      cout << -1;
      return 0;
    }
  }
  cout << cnt + 1;
}
