#include <bits/stdc++.h>
using namespace std;
int t[30], f[30];
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int n1 = s1.size();
  int n2 = s2.size();
  for (int i = 0; i < n2; i++) f[s2[i] - 'a']++;
  int ans = 0;
  for (int i = 0; i < n1; i++) {
    if (s1[i] != '?') t[s1[i] - 'a']++;
    if (i + 1 >= n2) {
      bool w = false;
      for (int j = 0; j < 26; j++)
        if (t[j] > f[j]) {
          w = true;
          break;
        }
      ans += !w;
      if (s1[i - n2 + 1] != '?') t[s1[i - n2 + 1] - 'a']--;
    }
  }
  cout << ans << endl;
  return 0;
}
