#include <bits/stdc++.h>
using namespace std;
bool match(vector<int> &orig, vector<int> &dup, int dummy) {
  int diff = 0;
  for (int i = 0; i < 26; i++) {
    diff += abs(orig[i] - dup[i]);
  }
  if (diff == dummy)
    return true;
  else
    return false;
}
int main() {
  string p, s;
  cin >> p >> s;
  vector<int> orig(26);
  vector<int> dup(26);
  int dummy = 0;
  int count = 0;
  if (p.length() < s.length())
    cout << 0 << endl;
  else {
    for (int i = 0; i < s.length(); i++) {
      orig[s[i] - 'a']++;
    }
    for (int i = 0; i < s.length(); i++) {
      if (p[i] == '?')
        dummy++;
      else
        dup[p[i] - 'a']++;
    }
    bool ans = match(orig, dup, dummy);
    if (ans == true) count++;
    for (int j = s.length(); j < p.length(); j++) {
      if (p[j] == '?')
        dummy++;
      else {
        dup[p[j] - 'a']++;
      }
      if (p[j - s.length()] == '?')
        dummy--;
      else {
        dup[p[j - s.length()] - 'a']--;
      }
      ans = match(orig, dup, dummy);
      if (ans == true) count++;
    }
    cout << count << endl;
  }
}
