#include <bits/stdc++.h>
using namespace std;
long long int arr[100005];
long long int brr[100005];
int main() {
  string s, p;
  cin >> s >> p;
  long long int n1 = s.size();
  long long int n2 = p.size();
  long long int i;
  long long int res = 0;
  for (i = 0; i < n2; ++i) {
    arr[p[i] - 'a']++;
  }
  for (i = 0; i < n1; ++i) {
    if (s[i] != '?') brr[s[i] - 'a']++;
    if (i >= n2) {
      if (s[i - n2] != '?') --brr[s[i - n2] - 'a'];
    }
    if (i >= (n2 - 1)) {
      bool find = 1;
      for (int j = 0; j < 26; ++j) {
        if (brr[j] > arr[j]) find = 0;
      }
      res += find;
    }
  }
  cout << res << endl;
  return 0;
}
