#include <bits/stdc++.h>
using namespace std;
char a[100005], b[100005];
int c[128] = {}, nz = 0;
int main(void) {
  scanf("%s%s", a, b);
  int n = strlen(a), m = strlen(b);
  int ans = 0;
  for (int i = 0; i < m; i++) c[(int)b[i]]++;
  for (int i = 0; i < m - 1; i++) nz += (c[(int)a[i]]-- == 0 && a[i] != '?');
  for (int i = m - 1; i < n; i++) {
    nz += (c[(int)a[i]]-- == 0 && a[i] != '?');
    if (nz == 0) ++ans;
    nz -= (++c[(int)a[i - m + 1]] == 0 && a[i - m + 1] != '?');
  }
  printf("%d\n", ans);
  return 0;
}
