#include <bits/stdc++.h>
using namespace std;
long long frq[26], ffreq[26], cnt = 0;
bool chk() {
  long long t = 0;
  for (long long i = 0; i < 26; i++) t += max(0LL, (frq[i] - ffreq[i]));
  if (t <= cnt) return true;
  return false;
}
int32_t main() {
  string s, t;
  cin >> s >> t;
  for (auto x : t) frq[x - 'a']++;
  long long ans = 0;
  long long n = s.size(), m = t.size();
  if (n < m) return cout << 0, 0;
  for (long long i = 0; i < m; i++) {
    if (s[i] == '?')
      cnt++;
    else
      ffreq[s[i] - 'a']++;
  }
  if (chk()) ans++;
  for (long long i = m; i < n; i++) {
    if (s[i - m] == '?')
      cnt--;
    else
      ffreq[s[i - m] - 'a']--;
    if (s[i] == '?')
      cnt++;
    else
      ffreq[s[i] - 'a']++;
    if (chk()) ans++;
  }
  cout << ans;
}
