#include <bits/stdc++.h>
using namespace std;
vector<int> g[26];
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int i = 0, j = 0;
  bool flag = true;
  int ans = 1;
  for (int i = 0; i < s1.size(); i++) {
    g[s1[i] - 'a'].push_back(i);
  }
  for (int i = 0; i < s2.size(); i++) {
    if (g[s2[i] - 'a'].size() == 0) {
      flag = false;
      break;
    }
  }
  if (!flag) {
    cout << -1;
    return 0;
  }
  int k = -1;
  for (int i = 0; i < s2.size(); i++) {
    int j = s2[i] - 'a';
    int v = lower_bound(g[j].begin(), g[j].end(), k + 1) - g[j].begin();
    if (v == g[j].size()) {
      ans++;
      v = g[j][0];
      k = v;
      continue;
    }
    k = g[j][v];
  }
  cout << ans;
  return 0;
}
