#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(nullptr);
  map<long long, vector<long long>> m;
  string s1, s2;
  cin >> s1 >> s2;
  long long n = -1, ans = 0, f = 0;
  for (long long i = 0; i < s1.size(); i++) m[s1[i] - 'a'].push_back(i);
  for (long long i = 0; i < s2.size(); i++) {
    long long c = s2[i] - 'a';
    if (m.find(c) == m.end()) {
      cout << -1;
      return 0;
    }
    auto it = upper_bound(m[c].begin(), m[c].end(), n);
    if (it == m[c].end()) {
      n = *m[c].begin();
      ans++;
    } else
      n = *it;
  }
  cout << ans + 1;
}
