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