#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
const long long int infl = LLONG_MAX;
int main() {
  string a, b;
  cin >> a >> b;
  int fa[26] = {0};
  int fb[26] = {0};
  int la = a.length();
  int lb = b.length();
  for (int i = 0; i < la; i++) {
    fa[a[i] - 'a'] = 1;
  }
  for (int i = 0; i < lb; i++) {
    fb[b[i] - 'a'] = 1;
  }
  int pos = 1;
  for (int i = 0; i < 26; i++) {
    if (fb[i] == 1 && fa[i] == 0) {
      pos = 0;
      break;
    }
  }
  if (pos == 0) {
    cout << "-1" << endl;
  } else {
    vector<long long int> count[26];
    for (long long int i = 0; i < la; i++) {
      int d = a[i] - 'a';
      count[d].push_back(i);
    }
    long long int ans = 1, la = 0;
    for (int i = 0; i < lb; i++) {
      int d = b[i] - 'a';
      if (count[d][count[d].size() - 1] < la) {
        ans++;
        la = count[d][0] + 1;
      } else {
        long long int k = lower_bound(count[d].begin(), count[d].end(), la) -
                          count[d].begin();
        k = count[d][k];
        la = k + 1;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
