#include <bits/stdc++.h>
using namespace std;
string world[8] = {"U", "D", "R", "L", "UL", "UR", "DR", "DL"};
const int rx[8] = {-1, 1, 0, 0, -1, -1, 1, 1};
const int ry[8] = {0, 0, 1, -1, -1, 1, 1, -1};
int main() {
  string a, s;
  cin >> a;
  cin >> s;
  int nx[a.length() + 1][30];
  int kl[30];
  for (int i = 0; i < 30; i++) kl[i] = -1;
  for (int i = a.length(); i >= 0; i--) {
    for (int j = 0; j < 30; j++) {
      nx[i][j] = kl[j];
    }
    if (i) {
      kl[a[i - 1] - 'a'] = i;
    }
  }
  for (int i = 0; i < s.length(); i++) {
    if (nx[0][s[i] - 'a'] == -1) {
      cout << -1;
      return 0;
    }
  }
  int ans = 1;
  int p = 0;
  for (int i = 0; i < s.length(); i++) {
    if (nx[p][s[i] - 'a'] == -1) {
      p = 0;
      ans++;
    }
    p = nx[p][s[i] - 'a'];
  }
  cout << ans;
  return 0;
}
