#include <bits/stdc++.h>
int main() {
  int la, lb, i, j, f, count, A[26] = {0}, B[26] = {0};
  char a[100005], b[100005];
  scanf("%s%s", a, b);
  la = strlen(a);
  lb = strlen(b);
  if (lb > la) {
    printf("0\n");
    return 0;
  }
  for (i = 0; i < lb; i++) {
    B[b[i] - 'a']++;
    if (a[i] != '?') A[a[i] - 'a']++;
  }
  f = count = 0;
  for (j = 0; j < 26; j++) {
    if (A[j] > B[j]) f = 1;
  }
  if (f == 0) count++;
  for (i = 1; i <= la - lb; i++) {
    if (a[i + lb - 1] != '?') A[a[i + lb - 1] - 'a']++;
    if (a[i - 1] != '?') A[a[i - 1] - 'a']--;
    f = 0;
    for (j = 0; j < 26; j++) {
      if (A[j] > B[j]) f = 1;
    }
    if (f != 1) count++;
  }
  printf("%d\n", count);
  return 0;
}
