#include <bits/stdc++.h>
using namespace std;
int res, pos = -1;
vector<int> p[26];
string a, b;
int main() {
  getline(cin, a);
  getline(cin, b);
  for (int i = 0; i < a.length(); i++) p[a[i] - 'a'].push_back(i);
  for (int i = 0; i < b.length(); i++) {
    if (p[b[i] - 'a'].empty()) {
      puts("-1");
      return 0;
    };
    vector<int>::iterator newp =
        upper_bound(p[b[i] - 'a'].begin(), p[b[i] - 'a'].end(), pos);
    if (newp == p[b[i] - 'a'].end()) {
      res++;
      pos = *p[b[i] - 'a'].begin();
    } else
      pos = *newp;
  };
  cout << res + 1;
  return 0;
}
