#include <bits/stdc++.h>
using namespace std;
const int MAX = 100002;
const int INF = 1 << 30;
const double EPS = 1e-7;
int A, B;
int cb[26], qa[MAX];
int ca[MAX][26];
char a[MAX], b[MAX];
int main() {
  ios::sync_with_stdio(false);
  cin >> (a + 1) >> (b + 1);
  A = strlen(a + 1);
  B = strlen(b + 1);
  for (int i = 1; i <= (A); ++i) {
    for (int j = 0; j < (26); ++j) ca[i][j] = ca[i - 1][j];
    qa[i] = qa[i - 1];
    if (a[i] == '?')
      ++qa[i];
    else
      ++ca[i][a[i] - 'a'];
  }
  for (int i = 1; i <= (B); ++i) ++cb[b[i] - 'a'];
  long long ans = 0;
  for (int i = B; i <= A; ++i) {
    int x = 0;
    for (int j = 0; j < (26); ++j) {
      int cj = ca[i][j] - ca[i - B][j];
      if (cj > cb[j]) goto next;
      x += (cb[j] - cj);
    }
    if (x == qa[i] - qa[i - B]) {
      ++ans;
    }
  next:;
  }
  cout << ans << endl;
  return 0;
}
