#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 1;
int cnt[27][M + 1]{0}, Cnt[26]{0};
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int m = t.size();
  for (int i = 0; i < n; i++) {
    int c = s[i] - 'a';
    if (c < 0) c = 26;
    cnt[c][i + 1]++;
  }
  for (int i = 1; i <= n; i++)
    for (int c = 0; c < 27; c++) cnt[c][i] += cnt[c][i - 1];
  for (char c : t) Cnt[c - 'a']++;
  int ans = 0;
  for (int i = 0; i + m <= n; i++) {
    int Extra = 0, fal = 0;
    for (int z = 0; z < 26; z++) {
      if (cnt[z][i + m] - cnt[z][i] > Cnt[z]) {
        fal = 1;
        break;
      }
      Extra += Cnt[z] - (cnt[z][i + m] - cnt[z][i]);
    }
    if (fal) continue;
    if (Extra == cnt[26][i + m] - cnt[26][i]) {
      ans++;
    }
  }
  printf("%d", ans);
}
