#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int v[26][10000];
  int n[26] = {0};
  for (int i = 0; i < s1.length(); i++) v[s1[i] - 'a'][n[s1[i] - 'a']++] = i;
  int k = 1, pos = -1;
  for (int i = 0; i < s2.length(); i++) {
    int c = s2[i] - 'a';
    if (n[c] == 0) {
      cout << -1;
      return 0;
    }
    int l = 0, r = n[c];
    while (l != r) {
      int m = (l + r) / 2;
      if (v[c][m] > pos)
        r = m;
      else
        l = m + 1;
    }
    if (v[c][l] <= pos) {
      pos = v[c][0];
      k++;
    } else
      pos = v[c][l];
  }
  cout << k;
  return 0;
}
