#include <bits/stdc++.h>
using namespace std;
int dp[10000 + 32][32];
int first[32];
int near[32];
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  memset(dp, -1, sizeof(dp));
  memset(near, -1, sizeof(near));
  memset(first, -1, sizeof(first));
  for (int i = s1.size() - 1; i >= 0; i--) {
    for (int j = 0; j < 32; j++) dp[i][j] = near[j];
    near[s1[i] - 'a'] = i;
  }
  for (int i = 0; i < s1.size(); i++)
    if (first[s1[i] - 'a'] == -1) first[s1[i] - 'a'] = i;
  int now = first[s2[0] - 'a'], cnt = 1, temp;
  if (first[s2[0] - 'a'] == -1) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i < s2.size(); i++) {
    now = dp[now][s2[i] - 'a'];
    if (now == -1) {
      now = first[s2[i] - 'a'];
      if (now == -1) {
        puts("-1");
        return 0;
      }
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
