#include <bits/stdc++.h>
using namespace std;
struct fp_t {
  int az[26];
  fp_t() {
    for (int i = (0); i < (26); i++) az[i] = 0;
  }
  bool operator==(const fp_t &fp) {
    for (int i = (0); i < (26); i++)
      if (az[i] > fp.az[i]) return false;
    return true;
  }
};
int main() {
  string s, t;
  int res = 0;
  cin >> s >> t;
  if (s.size() >= t.size()) {
    fp_t target, current;
    for (int i = (0); i < (int((t).size())); i++) target.az[t[i] - 'a']++;
    for (int i = (0); i < (t.size()); i++)
      if (s[i] != '?') current.az[s[i] - 'a']++;
    for (int i = t.size(), sp = 0; i < s.size(); i++, sp++) {
      if (current == target) res++;
      if (s[sp] != '?') current.az[s[sp] - 'a']--;
      if (s[i] != '?') current.az[s[i] - 'a']++;
    }
    if (current == target) res++;
  }
  cout << res;
  return 0;
}
