#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long mod = 1e9 + 7;
vector<long long> g[27];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s1, s2;
  cin >> s1 >> s2;
  long long n1 = s1.size(), n2 = s2.size(), i, j;
  for (i = 0; i < n1; ++i) g[s1[i] - 'a'].push_back(i);
  long long cnt = 1, prev = -1, it, sz;
  for (i = 0; i < n2; ++i) {
    j = s2[i] - 'a';
    sz = g[j].size();
    if (sz == 0) return cout << -1, 0;
    it = upper_bound(g[j].begin(), g[j].end(), prev) - g[j].begin();
    if (it == sz) it = 0, ++cnt;
    prev = g[j][it];
  }
  cout << cnt << '\n';
  return 0;
}
