#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int needed[26], have[26];
char s[maxn], p[maxn];
bool ok() {
  for (int i = 0; i < 26; i++) {
    if (have[i] > needed[i]) return false;
  }
  return true;
}
int solve() {
  memset(needed, 0, sizeof(needed));
  memset(have, 0, sizeof(have));
  int lens = strlen(s), lenp = strlen(p);
  if (lens < lenp) return 0;
  for (int i = 0; i < lenp; i++) {
    needed[(int)(p[i] - 'a')]++;
    if (s[i] != '?') have[(int)(s[i] - 'a')]++;
  }
  int ans = 0;
  if (ok()) ans++;
  for (int i = 1; i <= lens - lenp; i++) {
    if (s[i - 1] != '?') have[(int)(s[i - 1] - 'a')]--;
    if (s[i + lenp - 1] != '?') have[(int)(s[i + lenp - 1] - 'a')]++;
    if (ok()) ans++;
  }
  return ans;
}
int main() {
  gets(s);
  gets(p);
  cout << solve() << endl;
  return 0;
}
