#include <bits/stdc++.h>
using namespace std;
int T, cnt, idx = -1;
string a, b;
vector<long long> pos[26];
vector<long long>::iterator it;
void solve() {
  cin >> a >> b;
  for (long long i = (long long)0; i <= (long long)a.length() - 1; i++)
    pos[a[i] - 'a'].push_back(i);
  for (long long i = (long long)0; i <= (long long)b.length() - 1; i++) {
    char c = b[i];
    if (pos[c - 'a'].empty()) {
      cout << -1;
      return;
    }
    it = upper_bound(pos[c - 'a'].begin(), pos[c - 'a'].end(), idx);
    if (it == pos[c - 'a'].end()) {
      cnt++;
      idx = *(pos[c - 'a'].begin());
    } else
      idx = *it;
  }
  cout << cnt + 1 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
