#include <bits/stdc++.h>
using namespace std;
vector<int> c[29];
int main() {
  int at[2];
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++) c[s[i] - 'a'].push_back(i);
  int f = 0;
  int an = 1;
  for (int i = 0; i < t.length(); i++) {
    if (c[t[i] - 'a'].empty()) {
      cout << -1;
      return 0;
    }
    if (f > c[t[i] - 'a'][c[t[i] - 'a'].size() - 1]) {
      an++;
      f = 0;
      i--;
    } else
      f = c[t[i] - 'a']
           [lower_bound(c[t[i] - 'a'].begin(),
                        c[t[i] - 'a'].begin() + c[t[i] - 'a'].size(), f) -
            c[t[i] - 'a'].begin()] +
          1;
  }
  cout << an;
  return 0;
}
