#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int main() {
  int i;
  for (; cin >> s1 >> s2;) {
    int num1[26], num2[26];
    memset(num1, 0, sizeof(num1));
    memset(num2, 0, sizeof(num2));
    for (i = 0; i < s2.length(); i++) {
      num2[s2[i] - 'a']++;
    }
    int num = 0, ans = 0;
    if (s2.length() > s1.length())
      cout << ans << endl;
    else {
      for (i = 0; i < s2.length() - 1; i++) {
        if (s1[i] == '?')
          num++;
        else
          num1[s1[i] - 'a']++;
      }
      while (i < s1.length()) {
        if (i >= s2.length()) {
          if (s1[i - s2.length()] == '?')
            num--;
          else
            num1[s1[i - s2.length()] - 'a']--;
        }
        if (s1[i] == '?')
          num++;
        else
          num1[s1[i] - 'a']++;
        bool flag = true;
        for (int j = 0; j < 26; j++) {
          if (num1[j] > num2[j]) {
            flag = false;
          }
        }
        if (flag) ans++;
        i++;
      }
      cout << ans << endl;
    }
  }
}
