#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ss;
  cin >> s >> ss;
  const int N = 1e5 + 1;
  vector<vector<int> > cum(N, vector<int>(26, 0));
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] != '?') cum[i + 1][s[i] - 'a']++;
    for (int j = 0; j < 26; ++j) {
      cum[i + 1][j] += cum[i][j];
    }
  }
  int frs[26] = {};
  for (int i = 0; i < ss.size(); ++i) {
    frs[ss[i] - 'a']++;
  }
  int ans = 0;
  for (int i = ss.size(); i <= s.size(); i++) {
    bool b = 1;
    for (int j = 0; j < 26; ++j) {
      if (cum[i][j] - cum[i - ss.size()][j] > frs[j]) {
        b = 0;
        break;
      }
    }
    if (b) {
      ans++;
    }
  }
  cout << ans << endl;
}
