#include <bits/stdc++.h>
using namespace std;
char s[10100], p[1000010];
vector<int> a[30];
int main() {
  gets(s);
  gets(p);
  for (int i = 0; i < (strlen(s)); i++) a[s[i] - 'a'].push_back(i);
  int ans = 1, j = -1, n = strlen(p);
  for (int i = 0; i < (n); i++) {
    p[i] -= 'a';
    if (lower_bound(a[p[i]].begin(), a[p[i]].end(), j) != a[p[i]].end())
      j = *lower_bound(a[p[i]].begin(), a[p[i]].end(), j) + 1;
    else {
      if (a[p[i]].empty()) {
        puts("-1");
        return 0;
      }
      ans++, j = a[p[i]][0] + 1;
    }
  }
  printf("%d", ans);
}
