#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9 + 7);
const long long inf = (long long)(2e9);
const long long linf = (long long)(4e18);
void solve();
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}
const long long N = (long long)(2 * 1e5 + 10);
long long cnt[26];
map<char, vector<long long>> q;
void solve() {
  string s, t;
  cin >> s >> t;
  for (auto i = 0; i < s.length(); ++i) {
    cnt[s[i] - 'a']++;
    q[s[i]].push_back(i);
  }
  for (auto i = 0; i < t.length(); ++i) {
    if (cnt[t[i] - 'a'] == 0) {
      cout << -1 << "\n";
      return;
    }
  }
  long long ans = 1;
  long long post = 0, poss = 0;
  while (post < t.length()) {
    vector<long long>::iterator it =
        lower_bound(q[t[post]].begin(), q[t[post]].end(), poss);
    if (it == q[t[post]].end()) {
      poss = *lower_bound(q[t[post]].begin(), q[t[post]].end(), 0);
      poss++;
      ans++;
    } else {
      poss = *it;
      poss++;
    }
    post++;
  }
  cout << ans << "\n";
}
