#include <bits/stdc++.h>
using namespace std;
set<long long> idx[30];
string a, b;
int main() {
  cin >> a >> b;
  for (long long i = 0; i < a.size(); i++) {
    idx[a[i] - 'a'].insert(i + 1);
  }
  long long prev = 0;
  long long ans = 1;
  for (long long i = 0; i < b.size(); i++) {
    long long c = b[i] - 'a';
    if (idx[c].size() == 0) {
      cout << "-1\n";
      return 0;
    }
    auto it = idx[c].upper_bound(prev);
    if (it == idx[c].end()) {
      ans++;
      prev = *idx[c].begin();
      continue;
    } else {
      prev = *it;
    }
  }
  cout << ans << endl;
  return 0;
}
