#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
int main() {
  string s, u;
  cin >> s >> u;
  if (u.length() > s.length()) {
    cout << '0' << "\n";
    return 0;
  }
  vector<int> stanje(26, 0);
  for (int i = 0, _n = u.length(); i < _n; i++) stanje[(int)(u[i] - 'a')]++;
  vector<int> tr(26, 0);
  for (int i = 0, _n = u.length(); i < _n; i++) {
    if (s[i] == '?') continue;
    tr[(int)(s[i] - 'a')]++;
  }
  bool ok = 1;
  int rez = 0;
  for (int i = 0, _n = 26; i < _n; i++)
    if (stanje[i] < tr[i]) ok = 0;
  if (ok) rez++;
  for (int i = u.length(), _n = s.length(); i < _n; i++) {
    if (s[i] != '?') tr[(int)(s[i] - 'a')]++;
    if (s[i - u.length()] != '?') tr[(int)(s[i - u.length()] - 'a')]--;
    bool ok = 1;
    for (int i = 0, _n = 26; i < _n; i++)
      if (stanje[i] < tr[i]) ok = 0;
    if (ok) rez++;
  }
  cout << rez << "\n";
  return 0;
}
