#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  map<char, vector<int> > mp;
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++) mp[s1[i]].push_back(i);
  int cntr = 0;
  if (mp[s2[0]].size() == 0) {
    cout << -1;
    return 0;
  }
  int ind = mp[s2[0]][0];
  for (int i = 1; i < s2.size(); i++) {
    if (mp[s2[i]].size() == 0) {
      cout << -1;
      return 0;
    }
    int ans = -1;
    int low = 0, high = mp[s2[i]].size() - 1, mid;
    while (low <= high) {
      mid = (low + high) / 2;
      if (mp[s2[i]][mid] <= ind) {
        low = mid + 1;
      } else if (mp[s2[i]][mid] > ind) {
        high = mid - 1;
        ans = mp[s2[i]][mid];
      }
    }
    if (ans == -1) {
      cntr++;
      ind = mp[s2[i]][0];
    } else
      ind = ans;
  }
  cout << cntr + 1;
  return 0;
}
