#include <bits/stdc++.h>
using namespace std;
char s[100005], p[100005];
int cnts[26], cntp[26];
int main() {
  scanf("%s%s", s, p);
  int l1 = strlen(s), l2 = strlen(p);
  for (int i = 0; i < l2; i++) cntp[p[i] - 'a']++;
  int ans = 0;
  for (int i = 0; i < l1; i++) {
    if (s[i] != '?') cnts[s[i] - 'a']++;
    if (i - l2 + 1 >= 0) {
      ans++;
      for (int j = 0; j < 26; j++)
        if (cnts[j] > cntp[j]) {
          ans--;
          break;
        }
      if (s[i - l2 + 1] != '?') cnts[s[i - l2 + 1] - 'a']--;
    }
  }
  cout << ans << endl;
  return 0;
}
