#include <bits/stdc++.h>
using namespace std;
void pri(int a1[], int a2[]) {
  for (int i = 0; i < 26; i++) {
    cout << a1[i] << " " << a2[i] << endl;
  }
}
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int l1 = s1.length(), l2 = s2.length();
  if (l2 > l1) {
    cout << "0";
    return 0;
  }
  int qsn = 0;
  int a1[26], a2[26];
  int lp = 0, rp = 0 + l2 - 1;
  memset(a1, 0, sizeof a1);
  memset(a2, 0, sizeof a2);
  for (int i = 0; i < l2; i++) {
    a2[s2[i] - 'a']++;
    if (s1[i] == '?')
      qsn++;
    else
      a1[s1[i] - 'a']++;
  }
  int count = 0;
  while (rp < l1) {
    int nt = 0;
    for (int i = 0; i < 26; i++) {
      if (a1[i] > a2[i]) {
        goto INC;
      }
      nt += a2[i] - a1[i];
    }
    if (nt == qsn) count++;
  INC:
    if (s1[lp] == '?')
      qsn--;
    else
      a1[s1[lp] - 'a']--;
    if (rp + 1 < l1) {
      if (s1[rp + 1] == '?')
        qsn++;
      else
        a1[s1[rp + 1] - 'a']++;
    }
    lp++;
    rp++;
  }
  cout << count << endl;
  return 0;
}
