#include <bits/stdc++.h>
using namespace std;
vector<int> xs[30];
char s1[10010], s2[1000010];
map<int, int> mp;
int main() {
  int x, n, m, pos, ans, k;
  vector<int>::iterator y;
  scanf("%s%s", s1, s2);
  n = strlen(s1);
  for (int i = 0; i < n; i++) {
    x = s1[i] - 'a';
    xs[x].push_back(i);
    mp[x] = 1;
  }
  m = strlen(s2);
  pos = -1;
  ans = 1;
  for (int i = 0; i < m; i++) {
    x = s2[i] - 'a';
    if (!mp[x]) {
      puts("-1");
      return 0;
    }
    y = upper_bound(xs[x].begin(), xs[x].end(), pos);
    if (y == xs[x].end()) {
      ans++;
      y = xs[x].begin();
    }
    k = y - xs[x].begin();
    pos = xs[x][k];
  }
  printf("%d\n", ans);
  return 0;
}
