#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
using namespace std;
void solve() {
  string s1, s2;
  cin >> s1 >> s2;
  vector<vector<int>> cnt(26);
  for (int i = 0; i < (int)s1.size(); ++i) {
    cnt[s1[i] - 'a'].push_back(i);
  }
  int ans = 1, idx = -1;
  for (int i = 0; i < (int)s2.size(); ++i) {
    if (!(int)cnt[s2[i] - 'a'].size()) {
      cout << -1;
      return;
    }
    int pos =
        upper_bound(cnt[s2[i] - 'a'].begin(), cnt[s2[i] - 'a'].end(), idx) -
        cnt[s2[i] - 'a'].begin();
    if (pos == (int)cnt[s2[i] - 'a'].size()) {
      ++ans;
      idx = cnt[s2[i] - 'a'][0];
    } else {
      idx = cnt[s2[i] - 'a'][pos];
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
}
