#include <bits/stdc++.h>
using namespace std;
const int MaxN = 100500;
int a[30], b[30];
int main() {
  int i, j;
  string s, p;
  for (i = 0; i < 30; i++) {
    a[i] = 0;
    b[i] = 0;
  }
  cin >> s;
  cin >> p;
  if (s.length() < p.length()) {
    cout << 0 << endl;
    return 0;
  }
  int cnt = 0;
  for (i = 0; i < p.length(); i++) {
    a[p[i] - 'a']++;
  }
  for (i = 0; i < p.length(); i++) {
    if (s[i] == '?') {
      cnt++;
    } else {
      b[s[i] - 'a']++;
    }
  }
  int l = 0, r = p.length() - 1;
  int ans = 0;
  while (r < s.length()) {
    int cnt1 = 0;
    for (i = 0; i < 30; i++) {
      if (a[i] > b[i]) {
        cnt1 += a[i] - b[i];
      }
    }
    if (cnt >= cnt1) {
      ans++;
    }
    if (s[l] == '?') {
      cnt--;
    } else {
      b[s[l] - 'a']--;
    }
    l++;
    r++;
    if (r == s.length()) {
      break;
    }
    if (s[r] == '?') {
      cnt++;
    } else {
      b[s[r] - 'a']++;
    }
  }
  cout << ans << endl;
}
