#include <bits/stdc++.h>
using namespace std;
int A[26], B[26];
int main() {
  string inp1, inp2;
  cin >> inp1 >> inp2;
  if (inp1.length() < inp2.length()) {
    cout << 0 << endl;
  } else {
    int ans = 0, b = 0;
    for (int i = 0; i < inp2.length(); i++) {
      if (inp1[i] == '?')
        b++;
      else
        A[inp1[i] - 'a']++;
      B[inp2[i] - 'a']++;
    }
    for (int i = 0; (i + inp2.length()) <= inp1.length(); i++) {
      int c = 0;
      if (i != 0) {
        if (inp1[i + inp2.length() - 1] == '?')
          b++;
        else
          A[inp1[i + inp2.length() - 1] - 'a']++;
      }
      bool flag = true;
      for (int j = 0; j < 26; j++) {
        if (A[j] <= B[j])
          c += B[j] - A[j];
        else
          flag = false;
      }
      if (flag) {
        if (b == c) ans++;
      }
      if (inp1[i] == '?')
        b--;
      else
        A[inp1[i] - 'a']--;
    }
    printf("%d\n", ans);
  }
  return 0;
}
