#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  vector<int> ind[26];
  for (int i = 0; i < s1.length(); ++i) {
    ind[s1[i] - 'a'].push_back(i);
  }
  if (ind[s2[0] - 'a'].size() == 0) {
    cout << -1;
    return 0;
  }
  int cur = ind[s2[0] - 'a'][0];
  int ans = 1;
  for (int i = 1; i < s2.length(); ++i) {
    int j = s2[i] - 'a';
    if (ind[j].size() == 0) {
      cout << -1;
      return 0;
    }
    auto it = lower_bound(ind[j].begin(), ind[j].end(), cur + 1);
    if (it == ind[j].end())
      cur = ind[j][0], ans++;
    else
      cur = *it;
  }
  cout << ans;
}
