#include <bits/stdc++.h>
using namespace std;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int DX[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int DY[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
const int MAXX = 3 * (100000 + 9);
;
const long long OO = 1e8;
const int o_o = 0;
int innd = 1, curIndex = -1;
string s1, s2;
vector<int> p[30];
void build() {
  for (int i = 0; s1[i]; ++i) {
    int t = s1[i] - 'a';
    p[t].push_back(i);
  }
}
int main() {
  cin >> s1 >> s2;
  build();
  int t = s2[0] - 'a';
  if (p[t].empty()) {
    cout << -1;
    return 0;
  }
  curIndex = p[t][0];
  for (int i = 1; i < s2.size(); i++) {
    int t = s2[i] - 'a';
    if (p[t].empty()) {
      innd = -1;
      break;
    }
    vector<int>::iterator low = upper_bound(p[t].begin(), p[t].end(), curIndex);
    int index = (low - p[t].begin());
    if (index < p[t].size() && p[t][index] > curIndex) {
      curIndex = p[t][index];
    } else {
      innd++;
      curIndex = p[t][0];
    }
  }
  cout << innd << endl;
}
