#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
char a[10010], b[1000010];
vector<int> g[26];
int main() {
  scanf("%s %s", a, b);
  int n = strlen(a), m = strlen(b);
  for (int i = (int)0; i <= (int)n - 1; ++i) {
    g[a[i] - 'a'].push_back(i);
  }
  for (int i = (int)0; i <= (int)25; ++i) sort(g[i].begin(), g[i].end());
  int p = 0, res = 1;
  for (int i = (int)0; i <= (int)m - 1; ++i) {
    int c = b[i] - 'a';
    if ((int)g[c].size() == 0) {
      puts("-1");
      return 0;
    }
    int first = lower_bound(g[c].begin(), g[c].end(), p) - g[c].begin();
    if (first >= (int)g[c].size() || first < 0) {
      ++res;
      p = 1 + g[c][0];
    } else
      p = g[c][first] + 1;
  }
  cout << res << endl;
  return 0;
}
