#include <bits/stdc++.h>
using namespace std;
template <class T>
string toStr(T x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
template <class T1, class T2>
string toStr(pair<T1, T2> x) {
  return toStr(x.first) + ": " + toStr(x.second);
}
template <class T>
string containerToStr(T v) {
  string r = "[";
  for (__typeof(v.begin()) it = v.begin(); it != v.end(); ++it) {
    if (r != "[") r += ", ";
    r += toStr(*it);
  }
  return r + "]";
}
template <class T>
string toStr(vector<T> v) {
  return containerToStr(v);
}
template <class T>
string toStr(set<T> v) {
  return containerToStr(v);
}
template <class T1, class T2>
string toStr(map<T1, T2> v) {
  return containerToStr(v);
}
bool was[256];
char S1[1 << 20];
char S2[1 << 20];
vector<int> V[256];
int main() {
  scanf("%s %s", S1, S2);
  int n = 0;
  while (S1[n]) {
    was[S1[n]] = true;
    V[S1[n]].push_back(n);
    n++;
  }
  int cur = 0;
  int ans = 1;
  for (int i = 0; S2[i]; ++i) {
    if (!was[S2[i]]) {
      puts("-1");
      return 0;
    }
    char ch = S2[i];
    int x = lower_bound((V[ch]).begin(), (V[ch]).end(), cur) - V[ch].begin();
    if (x == ((int)((V[ch]).size()))) {
      x = 0;
      ++ans;
    }
    int p = V[ch][x] + 1;
    if (p == n) {
      p = 0;
      if (S2[i + 1]) ++ans;
    }
    cur = p;
  }
  cout << ans << endl;
  return 0;
}
