#include <bits/stdc++.h>
using namespace std;
string s, p;
int a[33], b[33];
bool check() {
  int baki = 0;
  for (int i = 0; i < 26; i++) {
    if (b[i] > a[i]) return false;
    baki += (a[i] - b[i]);
  }
  return (baki == b[30]);
}
int main() {
  cin >> s >> p;
  if (s.size() < p.size()) return cout << 0 << endl, 0;
  int i, j;
  for (i = 0; i < p.size(); i++) {
    a[p[i] - 'a']++;
  }
  for (i = 0; i < p.size(); i++) {
    if (s[i] == '?')
      b[30]++;
    else
      b[s[i] - 'a']++;
  }
  int ans = check();
  j = 0;
  for (i = p.size(); i < s.size(); i++, j++) {
    if (s[j] == '?')
      b[30]--;
    else
      b[s[j] - 'a']--;
    if (s[i] == '?')
      b[30]++;
    else
      b[s[i] - 'a']++;
    ans += check();
  }
  cout << ans << endl;
  return 0;
}
