#include <bits/stdc++.h>
using namespace std;
int main() {
  string in, out;
  cin >> in >> out;
  int s[26] = {0};
  int o[26] = {0};
  int a = in.length();
  int b = out.length();
  for (int i = 0; i < a; ++i) s[in[i] - 'a']++;
  for (int j = 0; j < b; ++j) o[out[j] - 'a']++;
  bool ans = true;
  for (int i = 0; i < 26; ++i) {
    if (s[i] == 0 && o[i] > 0) {
      ans = false;
    }
  }
  if (ans == false) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> allo[26];
  for (int i = 0; i < a; ++i) {
    allo[in[i] - 'a'].push_back(i);
  }
  int total = 1;
  int lastch = out[0] - 'a';
  int pos = allo[lastch][0];
  for (int i = 1; i < b; ++i) {
    int c = out[i] - 'a';
    int p = (int)(upper_bound(allo[c].begin(), allo[c].end(), pos) -
                  allo[c].begin());
    if (p == allo[c].size()) {
      total++;
      pos = allo[c][0];
    } else {
      pos = allo[c][p];
    }
  }
  cout << total << endl;
  return 0;
}
