#include <bits/stdc++.h>
using namespace std;
char s[200010], p[200010];
int a[30], b[30];
int main() {
  gets(s);
  gets(p);
  int slen = strlen(s), plen = strlen(p);
  if (slen < plen) {
    cout << 0 << endl;
    return 0;
  }
  int sp = 0;
  int ans = 0, cnt;
  for (int i = 0; i < plen; i++) {
    a[p[i] - 'a']++;
  }
  for (int i = 0; i < plen; i++) {
    if (s[i] != '?')
      b[s[i] - 'a']++;
    else
      sp++;
  }
  for (int i = 0;; i++) {
    int cnt = 0;
    for (int j = 0; j < 26; j++) {
      if (a[j] > b[j]) cnt += a[j] - b[j];
    }
    if (cnt == sp) ans++;
    if (i + plen == slen) break;
    if (s[i] == '?')
      sp--;
    else
      b[s[i] - 'a']--;
    if (s[i + plen] == '?')
      sp++;
    else
      b[s[i + plen] - 'a']++;
  }
  cout << ans << endl;
  return 0;
}
