#include <bits/stdc++.h>
using namespace std;
string s1;
string s2;
int l[26] = {0};
int l2[26] = {0};
int n, m;
int p;
int check() {
  for (int i = 0; i < 26; i++) {
    if (l2[i] > l[i]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  cin >> s1;
  cin >> s2;
  n = int((s1).size());
  m = int((s2).size());
  int ret = 0;
  if (m > n) {
    printf("0\n");
    return 0;
  }
  for (int i = 0; i < m; i++) {
    l[s2[i] - 'a']++;
  }
  for (int i = 0; i < m; i++) {
    if (s1[i] != '?') l2[s1[i] - 'a']++;
  }
  p = check();
  ret += p;
  for (int i = 1; i <= (n - m); i++) {
    p = 0;
    if (s1[i - 1] != '?') l2[s1[i - 1] - 'a']--;
    if (s1[i + m - 1] != '?') l2[s1[i + m - 1] - 'a']++;
    if (check()) p = 1;
    ret += p;
  }
  printf("%d\n", ret);
}
