#include <bits/stdc++.h>
using namespace std;
int n, num[30], nn[30];
char str[100010], sta[100010];
bool judge() {
  int re = num[0];
  for (int i = 1; i <= 26; i++) {
    if (num[i] <= nn[i])
      re -= nn[i] - num[i];
    else
      return 0;
  }
  if (re < 0)
    return 0;
  else
    return 1;
}
int main() {
  int t, i, j, ans = 0, len1, len2, tmp, t1, t2;
  cin >> str >> sta;
  len1 = strlen(str);
  len2 = strlen(sta);
  if (len1 < len2)
    cout << 0 << endl;
  else {
    for (i = 0; i < len2; i++) {
      tmp = sta[i] - 'a' + 1;
      nn[tmp]++;
    }
    for (i = 0; i < len2; i++) {
      if (str[i] == '?')
        num[0]++;
      else {
        tmp = str[i] - 'a' + 1;
        num[tmp]++;
      }
    }
    i = 0;
    j = len2 - 1;
    if (judge()) ans++;
    j++;
    for (; j < len1; i++, j++) {
      if (str[i] == '?')
        t1 = 0;
      else
        t1 = str[i] - 'a' + 1;
      if (str[j] == '?')
        t2 = 0;
      else
        t2 = str[j] - 'a' + 1;
      num[t1]--;
      num[t2]++;
      if (judge()) ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
