#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  if (((int)a.size() < (int)b.size()))
    cout << "0" << endl;
  else {
    int reqd[26] = {0};
    for (int i = (int)(0); i < (int)((int)b.size()); i++) reqd[b[i] - 'a'] += 1;
    int curr[26] = {0};
    for (int i = (int)(0); i < (int)((int)b.size()); i++) {
      if (a[i] == '?')
        continue;
      else
        curr[a[i] - 'a'] += 1;
    }
    int top = (int)b.size();
    int ans = 0;
    int bottom = 0;
    while (top <= (int)a.size()) {
      int f = 1;
      for (int i = (int)(0); i < (int)(26); i++)
        if (curr[i] > reqd[i]) f = 0;
      ans += f;
      if (top == (int)a.size()) break;
      if (a[top] != '?') curr[a[top] - 'a'] += 1;
      if (a[bottom] != '?') curr[a[bottom] - 'a'] -= 1;
      top += 1;
      bottom += 1;
    }
    cout << ans << endl;
  }
  return 0;
}
