#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
const long long maxn = (long long)2e3 + 10;
const long long maxm = (long long)20;
const int LOGN = 20;
const long long INF = 1e15 + 10;
const long long MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-12;
long long Power(long long x, long long n) {
  if (n == 0) return 1;
  long long r = Power(x, n / 2);
  r = r * r % MOD;
  if (n & 1) r = r * x % MOD;
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s1, s2;
  cin >> s1 >> s2;
  set<char> d1(s1.begin(), s1.end());
  set<char> d2(s2.begin(), s2.end());
  for (auto c : d2)
    if (!d1.count(c)) {
      cout << -1 << endl;
      return 0;
    }
  vector<vector<int>> a(128);
  for (int i = 0; i < s1.size(); ++i) {
    a[s1[i]].push_back(i);
  }
  int ans = 1;
  int p = -1;
  for (int i = 0; i < s2.size(); ++i) {
    auto c = s2[i];
    auto it = upper_bound(a[c].begin(), a[c].end(), p);
    if (it == a[c].end()) {
      ++ans;
      p = *upper_bound(a[c].begin(), a[c].end(), -1);
    } else {
      p = *it;
    }
  }
  cout << ans << endl;
  return 0;
}
