#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  bool a[26];
  vector<int> b[26];
  int pos, c, i, j;
  cin >> s1 >> s2;
  for (i = 0; i < 26; i++) {
    a[i] = false;
    b[i].clear();
  }
  for (i = 0; i < (int)s1.size(); i++) {
    a[s1[i] - 'a'] = true;
    b[s1[i] - 'a'].push_back(i);
  }
  for (i = 0; i < (int)s2.size(); i++) {
    if (!a[s2[i] - 'a']) {
      cout << "-1" << endl;
      return 0;
    }
  }
  c = 1;
  pos = 0;
  i = 0;
  while (i < (int)s2.size()) {
    for (j = 0; j < (int)b[s2[i] - 'a'].size(); j++) {
      if (pos <= b[s2[i] - 'a'][j]) break;
    }
    if (j == (int)b[s2[i] - 'a'].size()) {
      j = 0;
      c++;
    }
    pos = b[s2[i] - 'a'][j] + 1;
    i++;
  }
  cout << c << endl;
}
