#include <bits/stdc++.h>
using namespace std;
string s, p;
int ans, cs[26], cp[26];
int main() {
  cin >> s >> p;
  int n = s.size(), m = p.size();
  for (int i = 0; i < m; i++) {
    cp[p[i] - 'a']++;
  }
  if (n < m) {
    cout << 0 << endl;
    return 0;
  } else {
    for (int i = 0; i < n; i++) {
      if (s[i] != '?') {
        cs[s[i] - 'a']++;
      }
      if (i - m + 1 >= 0) {
        ans++;
        for (int j = 0; j < 26; j++) {
          if (cs[j] > cp[j]) {
            ans--;
            break;
          }
        }
        if (s[i - m + 1] != '?') {
          cs[s[i - m + 1] - 'a']--;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
