#include <bits/stdc++.h>
using namespace std;
char second[100010], p[100010];
int n, m, a[100010][27], b[27];
bool ok(int st) {
  for (int i = 1; i <= 26; i++) {
    if (a[st + m - 1][i] - a[st - 1][i] > b[i]) return false;
  }
  return true;
}
int main() {
  scanf("%s%s", second + 1, p + 1);
  n = strlen(second + 1);
  m = strlen(p + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 26; j++) a[i][j] = a[i - 1][j];
    if (second[i] == '?')
      a[i][0]++;
    else
      a[i][second[i] - 'a' + 1]++;
  }
  for (int i = 1; i <= m; i++) {
    if (p[i] == '?')
      b[0]++;
    else
      b[p[i] - 'a' + 1]++;
  }
  int ans = 0;
  for (int i = 1; i <= n - m + 1; i++) {
    if (ok(i)) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
