#include <bits/stdc++.h>
using namespace std;
const int maxn = 1 << 21;
const int mod = 1e9 + 7;
vector<int> a[26];
int j = -1, ans = 1;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < s1.length(); i++) a[s1[i] - 'a'].push_back(i);
  for (int i = 0; i < s2.length(); i++) {
    int leva = s2[i] - 'a';
    if (a[leva].size() == 0) return cout << -1, 0;
    int desna =
        upper_bound(a[leva].begin(), a[leva].end(), j) - a[leva].begin();
    if (desna == a[leva].size()) desna = 0, ans++;
    j = a[leva][desna];
  }
  cout << ans << endl;
  return 0;
}
