#include <bits/stdc++.h>
using namespace std;
double pi = 3.1415926536;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int arr1[28], arr2[28];
int counting() {
  for (int i = 0; i < 27; i++) {
    if (arr1[i] > arr2[i]) return 0;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  string s, p;
  cin >> s >> p;
  if (s.size() >= p.size())
    for (int i = 0; i < (int)p.size(); i++) {
      if (s[i] != '?') arr1[s[i] - 'a']++;
    }
  for (int i = 0; i < (int)p.size(); i++) {
    arr2[p[i] - 'a']++;
  }
  int counter = 0;
  if (s.size() >= p.size()) counter += counting();
  for (int i = (int)p.size(); i < (int)s.size(); i++) {
    if (s[i - p.size()] != '?') arr1[s[i - p.size()] - 'a']--;
    if (s[i] != '?') arr1[s[i] - 'a']++;
    counter += counting();
  }
  cout << counter;
}
