#include <bits/stdc++.h>
using namespace std;
int main() {
  string P, S;
  int occ[26] = {0}, err = 0, sol = 0;
  cin >> S >> P;
  int n = S.size();
  int m = P.size();
  if (n < m) {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < m; i++) occ[P[i] - 'a']++;
  for (int i = 0; i < m; i++) {
    if (S[i] == '?') continue;
    occ[S[i] - 'a']--;
    if (occ[S[i] - 'a'] == -1) err++;
  }
  for (int i = 0; i + m <= n; i++) {
    if (err == 0) sol++;
    if (i + m == n) break;
    if (S[i] != '?') {
      occ[S[i] - 'a']++;
      if (occ[S[i] - 'a'] == 0) err--;
    }
    if (S[i + m] != '?') {
      occ[S[i + m] - 'a']--;
      if (occ[S[i + m] - 'a'] == -1) err++;
    }
  }
  cout << sol;
  return 0;
}
