#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
long long sqr(long long n) { return n * n; }
double LOG(long long a, long long b) { return (log(a) / log(b)); }
long long GCD(long long a, long long b) {
  if (a < 0) return GCD(-a, b);
  if (b < 0) return GCD(a, -b);
  return (!b) ? a : GCD(b, a % b);
}
long long LCM(long long a, long long b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return (a * (b / GCD(a, b)));
}
long long BigMod(long long B, long long P, long long M) {
  if (!P) return 1;
  if (!(P % 2)) return sqr(BigMod(B, P / 2, M)) % M;
  return (B % M) * (BigMod(B, P - 1, M)) % M;
}
int amC[3][30][100500];
int sA, sB;
void findAm(string s, int tag) {
  int i, j;
  int l = (int)s.size();
  if (s[0] != '?')
    amC[tag][s[0] - 'a'][0] = 1;
  else
    amC[tag][29][0] = 1;
  for (i = 1; i < l; i++) {
    if (s[i] != '?')
      amC[tag][s[i] - 'a'][i] = 1;
    else
      amC[tag][29][i] = 1;
    for (j = 0; j < 26; j++) amC[tag][j][i] += amC[tag][j][i - 1];
    amC[tag][29][i] += amC[tag][29][i - 1];
  }
  return;
}
bool isGood(int s, int e) {
  int ct = 0;
  int i;
  for (i = 0; i < 26; i++) {
    int cE = amC[0][i][e], cS = amC[0][i][s], cN = amC[1][i][sB - 1];
    if (!s) {
      if (cE > cN) return false;
      ct += (cN - cE);
    } else {
      int tag = cE - amC[0][i][s - 1];
      if (tag > cN) return false;
      ct += (cN - tag);
    }
  }
  if (!ct) return true;
  int val;
  if (s)
    val = amC[0][29][e] - amC[0][29][s - 1];
  else
    val = amC[0][29][e];
  return (ct == val);
}
int main(void) {
  string a, b;
  memset(amC, 0, sizeof(amC));
  cin >> a >> b;
  findAm(a, 0);
  findAm(b, 1);
  int i;
  sA = (int)a.size(), sB = (int)b.size();
  int res = 0;
  for (i = 0;; i++) {
    if (i + sB > sA) break;
    res += isGood(i, i + sB - 1);
  }
  deb(res);
  return 0;
}
