#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > AdjList;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int Count[28];
int _free = 0;
bool valid() {
  int missed = 0;
  for (int i = 0; i < 26; i++) {
    if (Count[i] > 0)
      missed += Count[i];
    else if (Count[i] < 0)
      return false;
    if (missed > _free) return false;
  }
  return true;
}
int main() {
  string s, p;
  cin >> s >> p;
  if (s.size() < p.size()) {
    cout << 0 << endl;
    return 0;
  }
  memset(Count, 0, sizeof Count);
  for (int i = 0; i < p.size(); i++) {
    if (s[i] == '?')
      _free++;
    else
      Count[s[i] - 'a']--;
    Count[p[i] - 'a']++;
  }
  int count = 0;
  if (valid()) count++;
  for (int i = p.size(); i < s.size(); i++) {
    if (s[i] == '?')
      _free++;
    else
      Count[s[i] - 'a']--;
    if (s[i - p.size()] == '?')
      _free--;
    else
      Count[s[i - p.size()] - 'a']++;
    if (valid()) count++;
  }
  cout << count << endl;
  return 0;
}
