#include <bits/stdc++.h>
using namespace std;
char baca[1000005];
string a, b;
int aln, bln;
vector<int> pos[250];
int main() {
  scanf("%s", baca);
  a = baca;
  scanf("%s", baca);
  b = baca;
  aln = a.length();
  bln = b.length();
  for (int i = 0; i < (int)aln; ++i) pos[(int)a[i]].push_back(i);
  int ans = 0;
  for (int i = 0; i < (int)bln; ++i) {
    if (pos[(int)b[i]].size() == 0) {
      ans = -1;
      break;
    } else {
      ++ans;
      int cur = pos[(int)b[i]][0];
      while (1) {
        __typeof(pos[0].begin()) it = upper_bound(
            (pos[(int)b[i + 1]]).begin(), (pos[(int)b[i + 1]]).end(), cur);
        if (it == pos[(int)b[i + 1]].end()) break;
        ++i;
        int x = it - pos[(int)b[i + 1]].begin();
        cur = pos[(int)b[i + 1]][x];
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
