#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
int ocor[26];
int prefix[100010][26];
int blaublau[100010];
string s, t;
bool confere(int idx) {
  int cu = blaublau[idx];
  int aux[26];
  for (int i = 0; i < 26; i++) aux[i] = prefix[idx][i];
  idx -= t.size();
  if (idx >= 0) {
    cu -= blaublau[idx];
    for (int i = 0; i < 26; i++) aux[i] -= prefix[idx][i];
  }
  for (int i = 0; i < 26; i++) {
    if (aux[i] < ocor[i]) {
      if (cu >= ocor[i] - aux[i]) {
        cu -= (ocor[i] - aux[i]);
      } else
        return false;
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  ;
  cin >> s >> t;
  memset(prefix, 0, sizeof(prefix));
  memset(blaublau, 0, sizeof(blaublau));
  memset(ocor, 0, sizeof(ocor));
  for (int i = 0; i < s.size(); i++) {
    int aux = 0;
    if (s[i] == '?')
      blaublau[i]++;
    else
      prefix[i][s[i] - 'a'] = 1;
    if (i == 0) continue;
    blaublau[i] += blaublau[i - 1];
    for (int j = 0; j < 26; j++) {
      prefix[i][j] += prefix[i - 1][j];
    }
  }
  for (int i = 0; i < t.size(); i++) ocor[t[i] - 'a']++;
  int r = 0;
  for (int i = t.size() - 1; i < s.size(); i++) {
    if (confere(i)) r++;
  }
  cout << r << "\n";
  return 0;
}
