#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, p;
  cin >> s >> p;
  int freq[26] = {0};
  if (s.size() < p.size()) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < p.size(); i++) {
    freq[p[i] - 'a']++;
    if (s[i] != '?') freq[s[i] - 'a']--;
  }
  int tot = 0;
  int le = 0, ri = p.size() - 1;
  while (ri < s.size()) {
    int i = 0;
    while (i < 26 && freq[i] >= 0) i++;
    if (i == 26) tot++;
    if (s[le] != '?') freq[s[le] - 'a']++;
    le++;
    ri++;
    if (ri == s.size()) break;
    if (s[ri] != '?') freq[s[ri] - 'a']--;
  }
  cout << tot << endl;
  return 0;
}
