#include <bits/stdc++.h>
using namespace std;
queue<char, deque<char> > a;
queue<char, deque<char> > b;
int main() {
  int i, lens, lenp, cnt[26], chk[26], ans = 0, moo = 0, j;
  char s[100029], p[100029], temp;
  cin.getline(s, 100029);
  cin.getline(p, 100029);
  lens = strlen(s);
  lenp = strlen(p);
  for (i = 0; i < 26; i++) {
    cnt[i] = 0;
    chk[i] = 0;
  }
  if (lenp > lens) {
    printf("0\n");
    return 0;
  } else {
    for (i = 0; i < lens; i++) {
      a.push(s[i]);
    }
    for (i = 0; i < lenp; i++) {
      cnt[p[i] - 97]++;
    }
    for (i = 0; i < lenp; i++) {
      temp = a.front();
      if (temp != '?') {
        chk[temp - 97]++;
      }
      a.pop();
      b.push(temp);
    }
    for (i = 0; i < 26; i++) {
      if (chk[i] > cnt[i]) {
        moo = 1;
      }
    }
    if (moo == 0) {
      ans++;
    }
    moo = 0;
    for (i = 0; i < lens - lenp; i++) {
      temp = b.front();
      if (temp != '?') {
        chk[temp - 97]--;
      }
      b.pop();
      temp = a.front();
      if (temp != '?') {
        chk[temp - 97]++;
      }
      a.pop();
      b.push(temp);
      for (j = 0; j < 26; j++) {
        if (chk[j] > cnt[j]) {
          moo = 1;
        }
      }
      if (moo == 0) {
        ans++;
      }
      moo = 0;
    }
  }
  printf("%d\n", ans);
  return 0;
}
