#include <bits/stdc++.h>
using namespace std;
string s1, s2, s3;
bool used[30];
int f[10010][30];
int ans;
int main() {
  cin >> s1;
  cin >> s2;
  memset(used, 0, sizeof(used));
  for (int i = 0; i < s1.size(); i++) used[s1[i] - 'a'] = true;
  for (int i = 0; i < s2.size(); i++)
    if (!used[s2[i] - 'a']) {
      cout << -1 << endl;
      return 0;
    }
  memset(f, -1, sizeof(f));
  for (int i = s1.size(); i >= 0; i--) {
    for (int j = 0; j < 26; j++) f[i][j] = f[i + 1][j];
    if (i != s1.size()) f[i][s1[i] - 'a'] = i;
  }
  int x = 0;
  ans = 1;
  for (int i = 0; i < s2.size(); i++) {
    if (f[x][s2[i] - 'a'] != -1)
      x = f[x][s2[i] - 'a'] + 1;
    else {
      ans++;
      x = 0;
      i--;
    }
  }
  cout << ans << endl;
  return 0;
}
