#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1;
  cin >> s1;
  string s2;
  cin >> s2;
  int z = (int)s1.size();
  int dp[26][z + 5];
  for (int i = 0; i < 26; i++) dp[i][z] = -1;
  int x;
  bool exists[26];
  memset(exists, false, sizeof(exists));
  for (int i = z - 1; i >= 0; i--) {
    x = (int)s1[i] - 'a';
    exists[x] = true;
    for (int j = 0; j < 26; j++) dp[j][i] = dp[j][i + 1];
    dp[x][i] = i;
  }
  int count = 1, ind = 0;
  for (auto it : s2) {
    x = (int)it - 'a';
    if (!exists[x]) {
      cout << "-1" << endl;
      return 0;
    }
    if (dp[x][ind] == -1) {
      count++;
      ind = 0;
    }
    ind = dp[x][ind] + 1;
  }
  cout << count << endl;
  return 0;
}
