#include <bits/stdc++.h>
using namespace std;
int pre[10001][27];
bool mark[27] = {0};
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < 26; i++) pre[s1.size()][i] = -1;
  for (int i = s1.size() - 1; i >= 0; i--) {
    mark[s1[i] - 'a'] = 1;
    for (int j = 0; j < 26; j++) pre[i][j] = pre[i + 1][j];
    pre[i][s1[i] - 'a'] = i;
  }
  int ans = 0;
  int ind = 0;
  for (int i = 0; i < s2.size(); i++)
    if (!mark[s2[i] - 'a']) {
      cout << -1 << endl;
      return 0;
    }
  for (int i = 0; i < s2.size(); i++) {
    if (pre[ind][s2[i] - 'a'] == -1) {
      ans++;
      ind = 0;
      i--;
    } else {
      ind = pre[ind][s2[i] - 'a'] + 1;
    }
  }
  cout << ans + 1 << endl;
  return 0;
}
