#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
int pfreq[128], curfreq[128];
int match() {
  for (int i = 'a'; i < 'z' + 1; ++i) {
    if (curfreq[i] > pfreq[i]) return 0;
  }
  return 1;
}
int main() {
  string s, p;
  cin >> s >> p;
  if ((int)s.size() < (int)p.size()) {
    cout << 0 << endl;
    return 0;
  }
  memset(pfreq, 0, sizeof pfreq);
  memset(curfreq, 0, sizeof curfreq);
  for (int i = 0; i < (int)p.size(); ++i)
    pfreq[(int)p[i]]++, curfreq[(int)s[i]]++;
  int ans = 0;
  for (int en = (int)p.size() - 1, st = 0; en < (int)s.size(); ++en, ++st) {
    ans += match();
    if (en + 1 >= (int)s.size()) break;
    if (s[st] != '?') curfreq[(int)s[st]]--;
    if (s[en + 1] != '?') curfreq[(int)s[en + 1]]++;
  }
  cout << ans << endl;
  return 0;
}
