#include <bits/stdc++.h>
using namespace std;
template <int POS, class TUPLE>
void deploy(std::ostream &os, const TUPLE &tuple) {}
template <int POS, class TUPLE, class H, class... Ts>
void deploy(std::ostream &os, const TUPLE &t) {
  os << (POS == 0 ? "" : ", ") << get<POS>(t);
  deploy<POS + 1, TUPLE, Ts...>(os, t);
}
template <class T>
std::ostream &operator<<(std::ostream &os, std::vector<T> &v) {
  int remain = v.size();
  os << "{";
  for (auto e : v) os << e << (--remain == 0 ? "}" : ", ");
  return os;
}
template <class T>
std::ostream &operator<<(std::ostream &os, std::set<T> &v) {
  int remain = v.size();
  os << "{";
  for (auto e : v) os << e << (--remain == 0 ? "}" : ", ");
  return os;
}
template <class T, class K>
std::ostream &operator<<(std::ostream &os, std::map<T, K> &make_pair) {
  int remain = make_pair.size();
  os << "{";
  for (auto e : make_pair)
    os << "(" << e.first << " -> " << e.second << ")"
       << (--remain == 0 ? "}" : ", ");
  return os;
}
int memo[10100][30];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  string s, t;
  cin >> t;
  cin >> s;
  int now[30];
  memset(now, -1, sizeof(now));
  for (int i = ((int)(t).size()) - 1; i >= 0; i--) {
    now[t[i] - 'a'] = i;
    for (char c = 'a'; c <= 'z'; c++) {
      memo[i][c - 'a'] = now[c - 'a'];
    }
  }
  int p = 0;
  int ans = 1;
  for (int i = 0; i < (((int)(s).size())); i++) {
    if (memo[p][s[i] - 'a'] != -1) {
      p = memo[p][s[i] - 'a'] + 1;
      if (p == ((int)(t).size())) {
        p = 0;
        if (i != ((int)(s).size()) - 1) {
          ans += 1;
        }
      }
    } else {
      p = 0;
      ans += 1;
      if (memo[p][s[i] - 'a'] == -1) {
        cout << -1 << "\n";
        return 0;
      } else {
        p = memo[p][s[i] - 'a'] + 1;
        if (p == ((int)(t).size())) {
          p = 0;
          if (i != ((int)(s).size()) - 1) {
            ans += 1;
          }
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
