#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s1, s2;
  cin >> s1 >> s2;
  int n1 = s1.size(), n2 = s2.size();
  int arr1[26] = {0};
  for (auto i : s1) arr1[i - 97]++;
  for (auto i : s2)
    if (!arr1[i - 97]) {
      cout << -1;
      return 0;
    }
  vector<int> S2(n2);
  for (int i = 0; i < n2; i++) S2[i] = s2[i] - 97;
  vector<vector<int>> vec(26);
  for (int i = 0; i < n1; i++) vec[s1[i] - 97].emplace_back(i);
  int pos1 = -1;
  int ans = 1;
  for (int i = 0; i < n2; i++) {
    auto p = upper_bound(vec[S2[i]].begin(), vec[S2[i]].end(), pos1);
    if (p != vec[S2[i]].end())
      pos1 = *p;
    else {
      ans++;
      pos1 = -1;
      i--;
    }
  }
  cout << ans;
  return 0;
}
