#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
long long q = 0;
int Check(const vector<long long>& str, const vector<long long>& patt) {
  for (int i = 0; i < (int)(str).size(); i++) {
    if (patt[i] < str[i]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  string s, p;
  cin >> s >> p;
  if (p.size() > s.size()) {
    cout << "0" << endl;
    return 0;
  }
  vector<long long> str(40, 0);
  vector<long long> patt(40, 0);
  for (int i = 0; i < (int)(p).size(); i++) {
    patt[int(p[i]) - 'a']++;
    if (s[i] == '?') {
      q++;
      continue;
    }
    str[int(s[i]) - 'a']++;
  }
  long long res = Check(str, patt);
  for (long long i = (int)(p).size(); i < (int)(s).size(); ++i) {
    if (s[i] == '?') {
      q++;
    } else {
      str[int(s[i]) - 'a']++;
    }
    if (s[i - (int)(p).size()] == '?') {
      q--;
    } else {
      str[int(s[i - (int)(p).size()]) - 'a']--;
    }
    res += Check(str, patt);
  }
  cout << res << endl;
  return 0;
}
