#include <bits/stdc++.h>
using namespace std;
bool a[256];
int main() {
  string s1, s2;
  getline(cin, s1);
  getline(cin, s2);
  int n1 = s1.length(), n2 = s2.length();
  for (int i = 0; i <= 256; i++) a[i] = false;
  for (int i = 0; i < n1; i++) a[s1[i]] = true;
  for (int i = 0; i < n2; i++)
    if (!a[s2[i]]) {
      cout << -1;
      return 0;
    }
  string super = s1;
  int ans = 1, cur = 0, i = 0;
  bool ok = false;
  while (i < n2) {
    if (ok) {
      ans++;
      cur = 0;
      ok = false;
    }
    if (s2[i] == super[cur]) {
      i++;
    }
    cur++;
    if (cur > super.length() - 1) {
      ok = true;
    }
    if (ans > 11000) {
      cout << 960000;
      return 0;
    }
  }
  cout << ans;
  return 0;
}
