#include <bits/stdc++.h>
using namespace std;
char header[10010];
char wants[1000010];
vector<int> v[32];
int sw, sh, maior, runs;
int sizematch, pos;
int main() {
  for (int i = 0; i < 30; i++) v[i].clear();
  runs = 1;
  scanf("%s", header);
  sh = strlen(header);
  for (int i = 0; i < sh; i++) {
    v[header[i] - 'a'].push_back(i);
  }
  scanf("%s", wants);
  sw = strlen(wants);
  pos = 0;
  for (int i = 0; i < sw; i++) {
    maior = 0;
    int sizel = (int)v[wants[i] - 'a'].size();
    if (sizel == 0) {
      runs = -1;
      break;
    }
    if (pos >= sh) {
      pos = 0;
      runs++;
    }
    int k = wants[i] - 'a';
    int nextpos = lower_bound(v[k].begin(), v[k].end(), pos) - v[k].begin();
    if (nextpos > (int)v[k].size() - 1) {
      runs++;
      pos = v[k][0] + 1;
    } else {
      pos = v[k][nextpos] + 1;
    }
  }
  printf("%d\n", runs);
  return 0;
}
