#include <bits/stdc++.h>
using namespace std;
const int MAXS1 = 1e4;
string s1, s2;
int nxt[MAXS1][26];
int findNext(int curPoz, char ii) {
  if (nxt[curPoz][ii - 'a'] != -1) {
    return nxt[curPoz][ii - 'a'];
  }
  if (s1[curPoz] == ii) {
    nxt[curPoz][ii - 'a'] = curPoz;
  } else {
    nxt[curPoz][ii - 'a'] = findNext((curPoz + 1) % s1.length(), ii);
  }
  return nxt[curPoz][ii - 'a'];
}
int main() {
  cin >> s1 >> s2;
  bool cnt1[26] = {0}, cnt2[26] = {0};
  for (int i = 0; i < s1.length(); ++i) cnt1[s1[i] - 'a'] = 1;
  for (int i = 0; i < s2.length(); ++i) cnt2[s2[i] - 'a'] = 1;
  for (int i = 0; i < 26; ++i) {
    if (cnt2[i] && (!cnt1[i])) {
      cout << "-1\n";
      return 0;
    }
  }
  int poz = -1, cnt = 1;
  for (int i = 0; i < s1.length(); ++i) {
    for (int j = 0; j < 26; ++j) {
      nxt[i][j] = -1;
    }
  }
  for (int i = 0; i < s2.length(); ++i) {
    int npoz = findNext((poz + 1) % s1.length(), s2[i]);
    if (npoz <= poz) ++cnt;
    poz = npoz;
  }
  cout << cnt << "\n";
  return 0;
}
