#include <bits/stdc++.h>
using namespace std;
string s1, s2;
set<char> st;
vector<int> t[300];
int bin_search(char k, int ind) {
  int l = 0, r = t[k].size() - 1, m;
  while (l < r) {
    m = (l + r) / 2;
    if (ind == t[k][m]) return t[k][m];
    if (ind < t[k][m])
      r = m;
    else
      l = m + 1;
  }
  if (l && t[k][l - 1] == ind) return t[k][l - 1];
  return t[k][l];
}
int main() {
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++) t[s1[i]].push_back(i);
  for (int j = 0; j < s2.size(); j++)
    if (!t[s2[j]].size()) {
      cout << "-1";
      return 0;
    }
  int ans = 1, j = 0;
  for (int i = 0; i < s2.size(); i++) {
    int p = bin_search(s2[i], j);
    if (p < j) {
      ans++;
      j = bin_search(s2[i], 0) + 1;
    } else {
      j = p + 1;
    }
  }
  printf("%d", ans);
  return 0;
}
