#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
const int infi = 1e9;
const long long Linfi = (long long)9e18;
const long long MOD = 1000000007;
const int c1 = 31;
int n, m;
string s, t;
vector<int> pos[30];
int find_pos(int ch, int cur) {
  if (cur >= pos[ch].back()) return -1;
  if (pos[ch][0] > cur) return pos[ch][0];
  int low = 0, high = pos[ch].size() - 1, res = -1, mid;
  while (low <= high) {
    mid = (low + high) >> 1;
    if (pos[ch][mid] > cur) {
      res = mid;
      high = mid - 1;
    } else
      low = mid + 1;
  }
  return pos[ch][res];
}
void solve() {
  int ans = 1;
  for (int i = 1; i <= n; i++) pos[s[i] - 'a'].push_back(i);
  int cur = -1;
  for (int i = 1; i <= m; i++) {
    int ch = t[i] - 'a';
    if (pos[ch].size() == 0) {
      cout << -1 << endl;
      return;
    }
    cur = find_pos(ch, cur);
    if (cur == -1) {
      ans++;
      cur = pos[ch][0];
    }
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> s >> t;
  n = s.size();
  m = t.size();
  s = '0' + s;
  t = '0' + t;
  solve();
  return 0;
}
