#include <bits/stdc++.h>
using namespace std;
char s1[10005];
char s2[1000005];
int n, m;
int sol(vector<vector<int> >& v) {
  int last = -1;
  int ans = 1;
  for (int i = 0; i < m; i++) {
    if (v[s2[i]].size() == 0) return -1;
    int indx =
        upper_bound(v[s2[i]].begin(), v[s2[i]].end(), last) - v[s2[i]].begin();
    if (indx < v[s2[i]].size())
      last = v[s2[i]][indx];
    else {
      last = v[s2[i]][0];
      ans++;
    }
  }
  return ans;
}
int main() {
  while (scanf("%s", s1) == 1) {
    scanf("%s", s2);
    n = strlen(s1);
    m = strlen(s2);
    vector<vector<int> > v(512, vector<int>());
    for (int i = 0; i < n; i++) v[s1[i]].push_back(i);
    int ans = sol(v);
    printf("%d\n", ans);
  }
  return 0;
}
