#include <bits/stdc++.h>
using namespace std;
int o[500];
int ans;
int qzr[500];
void check() {
  for (int i = 'a'; i <= 'z'; i++) {
    if (o[i] > qzr[i]) return;
  }
  ans++;
}
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  if (s1.size() < s2.size()) {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < s2.size(); i++) {
    if (s1[i] != '?') o[s1[i]]++;
    qzr[s2[i]]++;
  }
  check();
  for (int i = 0; i < s1.size() - s2.size(); i++) {
    if (s1[i] != '?') o[s1[i]]--;
    if (s1[i + s2.size()] != '?') o[s1[i + s2.size()]]++;
    check();
  }
  cout << ans << endl;
  return 0;
}
