#include <bits/stdc++.h>
using namespace std;
char a[10001], b[1000001];
int n, m;
vector<int> nxt[26];
int main() {
  scanf("%s%s", a, b);
  n = strlen(a);
  m = strlen(b);
  for (int i = 0; i < n; ++i) nxt[a[i] - 'a'].push_back(i);
  int res = 0, at = n;
  for (int i = 0; i < m; ++i) {
    int c = b[i] - 'a';
    if (!nxt[c].size()) {
      res = -1;
      break;
    }
    int k = upper_bound(nxt[c].begin(), nxt[c].end(), at) - nxt[c].begin();
    if (k == (int)nxt[c].size()) {
      ++res;
      at = nxt[c][0];
    } else
      at = nxt[c][k];
  }
  printf("%d\n", res);
  return 0;
}
