#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  std::cin >> s >> t;
  unordered_map<char, vector<int> > hash;
  for (int i = 0; i < s.length(); i++) {
    hash[s[i]].push_back(i + 1);
  }
  int pos = 0, ans = 0;
  for (int i = 0; i < t.length(); i++) {
    if (hash.find(t[i]) == hash.end()) {
      std::cout << -1 << std::endl;
      return 0;
    }
    auto next = upper_bound(hash[t[i]].begin(), hash[t[i]].end(), pos);
    if (next == hash[t[i]].end()) {
      ans++;
      pos = hash[t[i]][0];
    } else {
      pos = *next;
    }
  }
  std::cout << ans + 1 << std::endl;
  return 0;
}
