#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  bool a1[25] = {};
  map<char, vector<int>> m;
  for (int i = 0; i < s1.length(); i++) {
    a1[s1[i] - 'a'] = true;
    m[s1[i]].push_back(i);
  }
  for (int i = 0; i < s2.length(); i++) {
    if (!a1[s2[i] - 'a']) {
      cout << "-1";
      return 0;
    }
  }
  int ans = 1;
  int cur = -1;
  for (int i = 0; i < s2.length(); i++) {
    char c = s2[i];
    auto it = upper_bound(m[c].begin(), m[c].end(), cur);
    if (it != m[c].end()) {
      int ind = *it;
      cur = ind;
    } else {
      ans++;
      cur = m[c][0];
    }
  }
  cout << ans;
}
