#include <bits/stdc++.h>
using namespace std;
char s1[100005], s2[100005];
int b[200], a[200];
int main() {
  int l1, l2, x, ans = 0;
  gets(s1);
  l1 = strlen(s1);
  gets(s2);
  l2 = strlen(s2);
  if (l2 > l1) {
    printf("0\n");
    return 0;
  }
  for (int i = 0; i < l2; i++) b[s2[i]]++;
  for (int i = 0; i < l2 - 1; i++) a[s1[i]]++;
  for (int i = l2 - 1; i < l1; i++) {
    a[s1[i]]++;
    x = 0;
    for (char ch = 'a'; ch <= 'z'; ch++)
      if (b[ch] > a[ch]) x += b[ch] - a[ch];
    if (x == a['?']) ans++;
    a[s1[i - l2 + 1]]--;
  }
  printf("%d\n", ans);
  return 0;
}
