#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int a[MAXN][30], b[30];
int main() {
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  if (s.length() < t.length()) {
    cout << 0 << endl;
    return 0;
  }
  s = ' ' + s;
  for (int i = 1; i < s.length(); i++) {
    for (int j = 0; j <= 'z' - 'a'; j++) a[i][j] = a[i - 1][j];
    if (s[i] != '?') a[i][s[i] - 'a']++;
  }
  int ans = 0;
  for (int i = 0; i < t.length(); i++) b[t[i] - 'a']++;
  for (int i = 1; i < s.length(); i++)
    if (i + t.length() - 1 >= s.length())
      break;
    else {
      int ind = i + t.length() - 1;
      bool can = true;
      for (int j = 0; j <= 'z' - 'a'; j++)
        if (a[ind][j] - a[i - 1][j] > b[j]) can = false;
      if (can) ans++;
    }
  cout << ans << endl;
  return 0;
}
