#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  map<char, set<long long int>> mp;
  string a, b;
  cin >> a >> b;
  for (long long int i = 0; i < a.size(); i++) mp[a[i]].insert(i);
  long long int ans = 1;
  long long int c = -1;
  for (long long int i = 0; i < b.size(); i++) {
    if (mp[b[i]].size() == 0) {
      cout << -1;
      return 0;
    }
    auto it = mp[b[i]].upper_bound(c);
    if (it == mp[b[i]].end()) {
      ans++;
      c = *mp[b[i]].begin();
    } else
      c = *it;
  }
  cout << ans;
  return 0;
}
