#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[10010], b[1000010];
vector<int> v[36];
void read() {
  scanf("%s%s", a, b);
  n = strlen(a);
  m = strlen(b);
}
void init() {
  int i;
  for (i = 0; i < n; i++) {
    v[a[i] - 'a'].push_back(i);
  }
}
int solve() {
  int i, j, ans = 1, pos = 0;
  for (i = 0; i < m; i++) {
    int t = b[i] - 'a';
    int sz = v[t].size();
    if (sz == 0) return -1;
    int l = 0;
    for (j = 0; j < sz; j++)
      if (v[t][j] > pos) {
        pos = v[t][j];
        l = 1;
        break;
      }
    if (l == 0) {
      pos = v[t][0];
      ans++;
    }
  }
  return ans;
}
int main() {
  read();
  init();
  printf("%d\n", solve());
  return 0;
}
