#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << '\n';
  err(++it, args...);
}
typedef tuple<int, int, int> State;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
const int N = 1e6 + 5;
const double EPS = 1e-10;
const long long INF = 1e18;
const double PI = acos(-1);
int n, m, k;
int dcmp(double a, double b) { return fabs(a - b) <= EPS ? 0 : a < b ? -1 : 1; }
string s, s2;
int arr[26];
int arr2[26];
int cnt = 0;
bool ok() {
  for (int i = 0; i < 26; i++) {
    if (arr[i] > arr2[i]) return 0;
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> s >> s2;
  if (s.size() < s2.size()) {
    cout << "0";
    return 0;
  }
  for (int i = 0; i < s2.size(); i++) {
    arr2[s2[i] - 'a']++;
    if (s[i] != '?')
      arr[s[i] - 'a']++;
    else
      cnt++;
  }
  int ans = ok();
  n = s2.size();
  for (int i = s2.size(); i < s.size(); i++) {
    if (s[i] != '?')
      arr[s[i] - 'a']++;
    else
      cnt++;
    if (s[i - n] != '?')
      arr[s[i - n] - 'a']--;
    else
      cnt--;
    ans += ok();
  }
  cout << ans << endl;
}
