#include <bits/stdc++.h>
using namespace std;
int main() {
  int alpha[26] = {0};
  string a, b;
  cin >> a >> b;
  int lth = b.size(), h, i, ana = 0, ans = 0;
  if (lth > a.size()) {
    cout << 0;
    return 0;
  }
  for (i = 0; i < lth; i++) alpha[b[i] - 'a']++;
  for (i = 0; i < lth; i++) {
    if (a[i] != '?') {
      alpha[a[i] - 'a']--;
      if (alpha[a[i] - 'a'] == -1) ana++;
    }
  }
  if (ana <= 0) ans++;
  for (i = lth; i < a.size(); i++) {
    h = i - lth;
    if (a[i] != '?') {
      alpha[a[i] - 'a']--;
      if (alpha[a[i] - 'a'] == -1) ana++;
    }
    if (a[h] != '?') {
      alpha[a[h] - 'a']++;
      if (alpha[a[h] - 'a'] == 0) ana--;
    }
    if (ana <= 0) ans++;
  }
  cout << ans;
  return 0;
}
