#include <bits/stdc++.h>
using namespace std;
int main() {
  int s1t[10002][26];
  string s1;
  char c;
  int i, j, k, n;
  cin >> s1;
  for (j = 0; j < 26; j++) {
    s1t[s1.length() - 1][j] = -1;
  }
  s1t[s1.length() - 1][s1[s1.length() - 1] - 'a'] = 0;
  for (i = s1.length() - 2; i >= 0; i--) {
    for (j = 0; j < 26; j++) {
      if (s1t[i + 1][j] != -1) {
        s1t[i][j] = s1t[i + 1][j] + 1;
      } else {
        s1t[i][j] = -1;
      }
    }
    s1t[i][s1[i] - 'a'] = 0;
  }
  scanf("%c", &c);
  j = 0;
  long ans = 1;
  while (scanf("%c", &c) == 1 && c != 10 && c != 13) {
    if (j >= s1.length()) {
      j = 0;
      ans++;
    }
    if (s1t[j][c - 'a'] == -1) {
      if (s1t[0][c - 'a'] == -1) {
        cout << "-1";
        return 0;
      }
      ans++;
      j = s1t[0][c - 'a'] + 1;
    } else {
      j += s1t[j][c - 'a'] + 1;
    }
  }
  cout << ans;
  return 0;
}
