#include <bits/stdc++.h>
using namespace std;
vector<int> pos[256];
int main() {
  char s[10005], s2[1000005];
  scanf(" %s %s", s, s2);
  for (int i = 0; s[i]; i++) pos[s[i]].push_back(i);
  int ans = 1;
  int cur = -1;
  for (int i = 0; s2[i]; i++) {
    int c = s2[i];
    if (pos[c].empty()) {
      printf("-1\n");
      return 0;
    }
    auto it = upper_bound(pos[c].begin(), pos[c].end(), cur);
    if (it == pos[c].end()) {
      ans++;
      cur = *pos[c].begin();
    } else
      cur = *it;
  }
  printf("%d\n", ans);
  return 0;
}
