#include <bits/stdc++.h>
using namespace std;
int snr[100002][26];
int pnr[26];
bool makesone(int b, int e) {
  for (int i = (0); i < (26); i++)
    if ((snr[e][i] - snr[b - 1][i]) > pnr[i]) return false;
  return true;
}
void clearsnr(int& nrsnr) {
  for (int k = (0); k < (26); k++) snr[nrsnr][k] = snr[nrsnr - 1][k];
}
int main() {
  memset(pnr, 0, sizeof pnr);
  ;
  memset(snr[0], 0, sizeof snr[0]);
  ;
  char c;
  int nrsnr = 1, nrpnr = 0;
  while (scanf("%c", &c) != (-1) && c != '\n' && c != '\r' && c != ' ') {
    clearsnr(nrsnr);
    if (c != '?') snr[nrsnr][c - 'a']++;
    nrsnr++;
  }
  while (scanf("%c", &c) != (-1) && c != '\n' && c != '\r' && c != ' ') {
    pnr[c - 'a']++;
    nrpnr++;
  }
  int ans = 0;
  if (nrpnr <= nrsnr)
    for (int i = 1; (i + nrpnr - 1) < nrsnr; i++)
      if (makesone(i, i + nrpnr - 1)) ans++;
  printf("%d\n", ans);
  return 0;
}
